Debian Codegraph @

gcc/testsuite/gdc.test/compilable/test21243.d

raw
1 // Parsing - expressions
2 auto a = auto ref (int x) => x;
3 auto b = auto ref (int x) { return x; };
4 auto c = function auto ref (int x) { return x; };
5 auto d = delegate auto ref (int x) { return x; };
6
7 // Parsing - aliases
8 alias e = auto ref (int x) => x;
9 alias f = auto ref (int x) { return x; };
10 alias g = function auto ref (int x) { return x; };
11 alias h = delegate auto ref (int x) { return x; };
12
13 // Semantic
14 void test()
15 {
16 alias fun(alias x) = auto ref () => x;
17 int n = 123;
18 auto _ = fun!123();
19 static assert(!__traits(compiles, &fun!123())); // rvalue
20 fun!n() = 456; // lvalue
21 }