blob: 4d203cbdb5bc12cc85b4fd399a5bdd38d8b2776f [file] [log] [blame]
/*
REQUIRED_ARGS: -dip1000
TEST_OUTPUT:
---
fail_compilation/test17422.d(23): Error: scope variable `p` may not be returned
---
*/
struct RC
{
Object get() return scope @trusted
{
return cast(Object) &store[0];
}
private:
ubyte[__traits(classInstanceSize, Object)] store;
}
Object test() @safe
{
RC rc;
auto p = rc.get; // p must be inferred as scope variable, works for int*
return p;
}