blob: 5ab7e6c56f1fd871c800635a01ef648fcad232b8 [file] [log] [blame]
/*
TEST_OUTPUT:
---
fail_compilation/fail13336a.d(28): Error: choose(true) is not an lvalue
---
*/
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();
}