Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue 21927 - ICE (illegal instruction) with static foreach over …
…empty member template
- Loading branch information
1 parent
4ce4209
commit 96d3885
Showing
3 changed files
with
56 additions
and
0 deletions.
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,30 @@ | ||
// https://issues.dlang.org/show_bug.cgi?id=21927 | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
T1(Args...) | ||
T1!() | ||
T2(Args2...) | ||
T2!() | ||
this.T2(Args2...) | ||
this.T2!() | ||
--- | ||
*/ | ||
template T1(Args...) {} | ||
|
||
pragma(msg, T1); // TOK.template_ | ||
pragma(msg, T1!()); // TOK.scope_ | ||
|
||
struct S | ||
{ | ||
template T2(Args2...) {} | ||
|
||
pragma(msg, S.T2); // TOK.template_ | ||
pragma(msg, S.T2!()); // TOK.scope_ | ||
|
||
void fun() | ||
{ | ||
pragma(msg, this.T2); // TOK.dotTemplateDeclaration | ||
pragma(msg, this.T2!()); // TOK.dot | ||
} | ||
} |
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,22 @@ | ||
// https://issues.dlang.org/show_bug.cgi?id=21927 | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/test21927.d(19): Error: invalid `foreach` aggregate `this.T2(Args2...)` | ||
fail_compilation/test21927.d(19): Error: invalid `foreach` aggregate `this.T2(Args2...)` | ||
fail_compilation/test21927.d(20): Error: invalid `foreach` aggregate `this.T2!()` | ||
fail_compilation/test21927.d(20): Error: invalid `foreach` aggregate `this.T2!()` | ||
--- | ||
*/ | ||
|
||
struct S | ||
{ | ||
template T2(Args2...) {} | ||
|
||
void fun() | ||
{ | ||
// original test case | ||
static foreach (p; this.T2) {} // ICE | ||
static foreach (p; this.T2!()) {} // ICE | ||
} | ||
} |