mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
21 lines
601 B
D
21 lines
601 B
D
// Parsing - expressions
|
|
auto a = auto ref (int x) => x;
|
|
auto b = auto ref (int x) { return x; };
|
|
auto c = function auto ref (int x) { return x; };
|
|
auto d = delegate auto ref (int x) { return x; };
|
|
|
|
// Parsing - aliases
|
|
alias e = auto ref (int x) => x;
|
|
alias f = auto ref (int x) { return x; };
|
|
alias g = function auto ref (int x) { return x; };
|
|
alias h = delegate auto ref (int x) { return x; };
|
|
|
|
// Semantic
|
|
void test()
|
|
{
|
|
alias fun(alias x) = auto ref () => x;
|
|
int n = 123;
|
|
auto _ = fun!123();
|
|
static assert(!__traits(compiles, &fun!123())); // rvalue
|
|
fun!n() = 456; // lvalue
|
|
}
|