Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Issue 12838 - Dmd show ICEs when using Tuple and wrong type
- Loading branch information
Showing
2 changed files
with
76 additions
and
40 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,28 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/ice12838.d(27): Error: cannot implicitly convert expression (1) of type int to string | ||
--- | ||
*/ | ||
|
||
struct Tuple(T...) | ||
{ | ||
T field; | ||
alias field this; | ||
} | ||
|
||
struct Data | ||
{ | ||
string a; | ||
} | ||
|
||
template toTuple(T) | ||
{ | ||
mixin(`alias toTuple = Tuple!(string);`); | ||
} | ||
|
||
void main() | ||
{ | ||
toTuple!Data a; | ||
a[0] = 1; // ICE! | ||
} |