Bug 22516 – Segfault for function literal in struct initializer with previous errors
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-11-17T08:48:59Z
Last change time
2021-12-14T10:34:25Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2021-11-17T08:48:59Z
The following code segfaults since 2.072:
struct Data
{
void function() eval;
}
struct Builtins
{
X x; // Unknown type X
Data myData = { (){} };
}
The problem here is that the error in `x` causes semantic3 for the function literal to be skipped because of errors in the parent. Later code tries to access the missing return type of the function literal.
Comment #1 by dlang-bot — 2021-11-17T09:07:31Z
@MoonlightSentinel created dlang/dmd pull request #13313 "Fix 22516 - Set TypeError as return type if inference was skipped..." fixing this issue:
- Fix 22516 - Set TypeError as return type if inference was skipped...
... due to previous errors in the parent.
This ensures that further code doesn't have to check for unset
return type while still keeping the other information (paramter types,
...) available.
https://github.com/dlang/dmd/pull/13313
Comment #2 by dlang-bot — 2021-11-18T09:20:58Z
dlang/dmd pull request #13313 "Fix 22516 - Set TypeError as return type if inference was skipped..." was merged into stable:
- 6acd696dd0a42accbf7571692a35426b2f7ef36c by MoonlightSentinel:
Fix 22516 - Set TypeError as return type if inference was skipped...
... due to previous errors in the parent.
This ensures that further code doesn't have to check for unset
return type while still keeping the other information (paramter types,
...) available.
https://github.com/dlang/dmd/pull/13313
Comment #3 by dlang-bot — 2021-12-14T10:34:25Z
dlang/dmd pull request #13421 "merge stable" was merged into master:
- 1c6bd4ea55015a97a8b2b977a23d55053d495425 by Florian:
Fix 22516 - Set TypeError as return type if inference was skipped... (#13313)
... due to previous errors in the parent.
This ensures that further code doesn't have to check for unset
return type while still keeping the other information (paramter types,
...) available.
https://github.com/dlang/dmd/pull/13421