Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4103 from 9rnsr/fix13668
Issue 13668 - [ICE] unable to compile __traits(allMembers...)
- Loading branch information
Showing
2 changed files
with
44 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,38 @@ | ||
// REQUIRED_ARGS: -o- | ||
// PERMUTE_ARGS: | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
tuple("id", "toString", "toHash", "opCmp", "opEquals", "Monitor", "factory") | ||
genProps | ||
--- | ||
*/ | ||
|
||
class User : Entity!User | ||
{ | ||
int id; | ||
} | ||
|
||
class Entity(T) | ||
{ | ||
pragma(msg, generateProperties!T); | ||
/* Compiler runs pragma(msg) in semantic() phase, but it does not insert any members | ||
* in this class. Therefore getting __traits(allMembers, User) while evaluating | ||
* generateProperties!User should work. | ||
*/ | ||
} | ||
|
||
template generateProperties(alias To) | ||
{ | ||
string getProperties(alias Ta)() | ||
{ | ||
string toRet = "genProps"; | ||
|
||
// This line is bad | ||
pragma(msg, __traits(allMembers, Ta)); | ||
|
||
return toRet; | ||
} | ||
|
||
enum generateProperties = getProperties!(To); | ||
} |