| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/ice12350.d(15): Error: type `MyUDC` has no value |
| 5 |
fail_compilation/ice12350.d(30): Error: template instance `ice12350.testAttrs!(MyStruct)` error instantiating |
| 6 |
--- |
| 7 |
*/ |
| 8 |
|
| 9 |
|
| 10 |
enum MyUDC; |
| 11 |
|
| 12 |
struct MyStruct |
| 13 |
{ |
| 14 |
int a; |
| 15 |
@MyUDC int b; |
| 16 |
} |
| 17 |
|
| 18 |
void testAttrs(T)(const ref T t) |
| 19 |
if (is(T == struct)) |
| 20 |
{ |
| 21 |
foreach (name; __traits(allMembers, T)) |
| 22 |
{ |
| 23 |
auto tr = __traits(getAttributes, __traits(getMember, t, name)); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
void main() |
| 28 |
{ |
| 29 |
MyStruct s; |
| 30 |
testAttrs(s); |
| 31 |
} |