d: Merge upstream dmd 47871363d, druntime, c52e28b7, phobos 99e9c1b77.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / issue15478.d
blob7bc16c806ffb357112583f69d25fb07147f2e53e
1 ////////////////////////////////////////////////////////////////////////////////
2 // https://issues.dlang.org/show_bug.cgi?id=15478
4 void test15478_1()
6 struct Foo(N)
8 this(N value) { }
9 static int bug() { return 0; }
11 enum Foo!int foo = 0;
12 Foo!int[foo.bug] bar;
15 void test15478_2()
17 int getLength() { return 42; }
18 struct Get {static int length() { return 42; }}
20 int[getLength] i1;
21 int[Get.length] i2;
22 static assert (is(typeof(i1) == int[42]));
23 static assert (is(typeof(i2) == int[42]));
26 ////////////////////////////////////////////////////////////////////////////////
27 // https://issues.dlang.org/show_bug.cgi?id=21870
28 struct S21870
30 @property size_t count() const
32 return 1;
36 int[S21870.init.count()] x; // OK
37 int[S21870.init.count ] y; // error
39 ////////////////////////////////////////////////////////////////////////////////
41 struct Foo15478(N)
43 this(N value) { }
44 auto bug() { return 0; }
47 void test15478_3()
49 enum Foo15478!int foo = 0;
50 Foo15478!int[foo.bug] bar; // Error: integer constant expression expected instead of Foo().bug
52 enum foo_bug = foo.bug;
53 Foo15478!int[foo_bug] baz; // OK