1 // REQUIRED_ARGS: -o-
2 // PERMUTE_ARGS:
3 /*
4 TEST_OUTPUT:
5 ---
6 tuple("id", "toString", "toHash", "opCmp", "opEquals", "Monitor", "factory")
7 genProps
8 ---
9 */
10
11 class User : Entity!User
12 {
13 int id;
14 }
15
Entity(T)16 class Entity(T)
17 {
18 pragma(msg, generateProperties!T);
19 /* Compiler runs pragma(msg) in semantic() phase, but it does not insert any members
20 * in this class. Therefore getting __traits(allMembers, User) while evaluating
21 * generateProperties!User should work.
22 */
23 }
24
generateProperties(alias To)25 template generateProperties(alias To)
26 {
27 string getProperties(alias Ta)()
28 {
29 string toRet = "genProps";
30
31 // This line is bad
32 pragma(msg, __traits(allMembers, Ta));
33
34 return toRet;
35 }
36
37 enum generateProperties = getProperties!(To);
38 }
39