Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gdc.test/fail_compilation/test17422.d @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
line wrap: on
line source
/* 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; }