gcc/testsuite/gdc.test/fail_compilation/scope_class.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/scope_class.d(12): Error: functions cannot return `scope scope_class.C` |
| 5 | --- |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | |
| 10 | scope class C { int i; } // Notice the use of `scope` here |
| 11 | |
| 12 | C increment(C c) |
| 13 | { |
| 14 | c.i++; |
| 15 | return c; |
| 16 | } |
| 17 | |
| 18 | void main() |
| 19 | { |
| 20 | scope C c = new C(); |
| 21 | c.increment(); |
| 22 | } |