Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue 15922: DMD segfault in functionParameters on invalid code
`Dsymbol.errors` is used to indicate a symbol failed semantic analysis. Currently, `FuncDeclaration.semantic3` fails if the parent has error, so the body of aggregates that already have errors is not processed. However, the code was only `return`ing and not setting `Dsymbol.errors` to `true`, resulting in this error being unnoticed by `functionSemantic`.
- Loading branch information
1 parent
72bfdf6
commit aa0df5c
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/ice15922.d(12): Error: function ice15922.ValidSparseDataStore!int.ValidSparseDataStore.correctedInsert!false.correctedInsert has no return statement, but is expected to return a value of type int | ||
fail_compilation/ice15922.d(10): Error: template instance ice15922.ValidSparseDataStore!int.ValidSparseDataStore.correctedInsert!false error instantiating | ||
fail_compilation/ice15922.d(15): instantiated from here: ValidSparseDataStore!int | ||
fail_compilation/ice15922.d(3): Error: need 'this' for 'insert' of type 'pure @nogc @safe int()' | ||
fail_compilation/ice15922.d(15): Error: template instance ice15922.StorageAttributes!(ValidSparseDataStore!int) error instantiating | ||
--- | ||
*/ | ||
#line 1 | ||
template StorageAttributes(Store) | ||
{ | ||
enum hasInsertMethod = Store.insert; | ||
enum hasFullSlice = Store.init[]; | ||
} | ||
struct ValidSparseDataStore(DataT) | ||
{ | ||
DataT insert() | ||
{ | ||
correctedInsert!(false); | ||
} | ||
DataT correctedInsert(bool CorrectParents)() {} | ||
auto opSlice() inout {} | ||
} | ||
alias BasicCubeT = StorageAttributes!(ValidSparseDataStore!int); |