gcc/testsuite/gdc.test/fail_compilation/fail7751.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/fail7751.d(15): Error: no constructor for `Foo` |
| 5 | fail_compilation/fail7751.d(23): Error: template instance `fail7751.foo!int` error instantiating |
| 6 | --- |
| 7 | */ |
| 8 | class Foo(T) |
| 9 | { |
| 10 | T x; |
| 11 | Foo y; |
| 12 | } |
| 13 | auto foo(T)(T x, Foo!T y=null) |
| 14 | { |
| 15 | return new Foo!T(x, y); |
| 16 | } |
| 17 | void bar(U)(U foo, U[] spam=[]) |
| 18 | { |
| 19 | spam ~= []; |
| 20 | } |
| 21 | void main() |
| 22 | { |
| 23 | bar(foo(0)); |
| 24 | } |