view gcc/testsuite/gdc.test/fail_compilation/ice12350.d @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 1830386684a0
children
line wrap: on
line source

/*
TEST_OUTPUT:
---
fail_compilation/ice12350.d(15): Error: type MyUDC has no value
fail_compilation/ice12350.d(30): Error: template instance ice12350.testAttrs!(MyStruct) error instantiating
---
*/


enum MyUDC;

struct MyStruct
{
    int a;
    @MyUDC int b;
}

void testAttrs(T)(const ref T t)
if (is(T == struct))
{
    foreach (name; __traits(allMembers, T))
    {
        auto tr = __traits(getAttributes, __traits(getMember, t, name));
    }
}

void main()
{
    MyStruct s;
    testAttrs(s);
}