dmd/compiler/test/compilable/test23168.d
2022-07-09 18:53:07 +02:00

30 lines
612 B
D

// https://issues.dlang.org/show_bug.cgi?id=23168
// Issue 23168 - [DIP1000] return scope wrongly rewritten for structs with no indirections
@safe:
struct Ptr
{
int* fun() return scope { return null; }
}
int* funf(ref return scope Ptr p) { return null; }
int* use()
{
Ptr ptr;
return ptr.fun;
return funf(ptr);
}
// Prevent forward reference 'regression'
// See https://github.com/dlang/dmd/pull/14232#issuecomment-1162906573
struct S
{
void f() scope {}
alias x = _get_value;
static if (true)
int _get_value() {return 3;}
else
int _get_value() {return 4;}
}