dmd/compiler/test/fail_compilation/fail13336b.d
2023-11-13 00:40:35 +01:00

25 lines
435 B
D

// REQUIRED_ARGS: -o-
int sx;
double sy;
/*
TEST_OUTPUT:
---
fail_compilation/fail13336b.d(16): Error: cannot `ref` return expression `cast(double)sx` because it is not an lvalue
fail_compilation/fail13336b.d(24): Error: cannot `ref` return expression `cast(double)sx` because it is not an lvalue
---
*/
ref f1(bool f)
{
if (f)
return sx;
return sy;
}
ref f2(bool f)
{
if (f)
return sy;
return sx;
}