blob: e3f990c2fdfc25b810700406b93bb257d5614168 [file] [log] [blame]
/*
TEST_OUTPUT:
---
fail_compilation/fail13336a.d(28): Error: `choose(true)` is not an lvalue and cannot be modified
---
*/
class Animal {}
class Cat : Animal {}
class Dog : Animal {}
Animal animal;
Cat cat;
auto ref choose(bool f)
{
if (f)
return cat;
else
return animal;
}
void main()
{
//pragma(msg, typeof(&choose));
static assert(is(typeof(&choose) == Animal function(bool) nothrow @nogc @safe)); // pass
choose(true) = new Dog();
}