d: Merge upstream dmd ff57fec515, druntime ff57fec515, phobos 17bafda79.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / tolvalue.d
blobe911dff77296276af81dc8f972dc08f624036cb1
1 /**
2 TEST_OUTPUT:
3 ---
4 fail_compilation/tolvalue.d(28): Error: cannot take address of template `templateFunc(T)()`, perhaps instantiate it first
5 fail_compilation/tolvalue.d(29): Error: cannot take address of type `int`
6 fail_compilation/tolvalue.d(30): Error: cannot take address of constant `3`
7 fail_compilation/tolvalue.d(31): Error: cannot take address of operator `$`
8 fail_compilation/tolvalue.d(32): Error: cannot take address of compiler-generated variable `__ctfe`
9 fail_compilation/tolvalue.d(33): Error: cannot take address of manifest constant `f`
10 fail_compilation/tolvalue.d(38): Error: cannot create default argument for `ref` / `out` parameter from constant `3`
11 fail_compilation/tolvalue.d(39): Error: cannot create default argument for `ref` / `out` parameter from compiler-generated variable `__ctfe`
12 fail_compilation/tolvalue.d(40): Error: cannot create default argument for `ref` / `out` parameter from manifest constant `f`
13 fail_compilation/tolvalue.d(45): Error: cannot modify constant `3`
14 fail_compilation/tolvalue.d(46): Error: cannot modify compiler-generated variable `__ctfe`
15 fail_compilation/tolvalue.d(47): Error: cannot modify manifest constant `f`
16 ---
19 // https://issues.dlang.org/show_bug.cgi?id=24238
21 void templateFunc(T)() {}
22 alias intAlias = int;
23 enum E { f }
25 void addr()
27 int[] a;
28 auto x0 = &templateFunc;
29 auto x1 = &intAlias;
30 auto x2 = &3;
31 auto x3 = a[&$];
32 auto x4 = &__ctfe;
33 auto x6 = &E.f;
36 void refArg()
38 void f0(ref int = 3) {}
39 void f1(ref bool = __ctfe) {}
40 void f3(ref E = E.f) {}
43 void inc(int lz)
45 3++;
46 __ctfe++;
47 E.f++;