Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Sebastian Redl | 42dddbe | 2009-11-08 10:16:43 +0000 | [diff] [blame] | 2 | |
| 3 | // PR5426 - the non-dependent obj would be fully processed and wrapped in a |
| 4 | // CXXConstructExpr at definition time, which would lead to a failure at |
| 5 | // instantiation time. |
| 6 | struct arg { |
| 7 | arg(); |
| 8 | }; |
| 9 | |
| 10 | struct oldstylemove { |
| 11 | oldstylemove(oldstylemove&); |
| 12 | oldstylemove(const arg&); |
| 13 | }; |
| 14 | |
| 15 | template <typename T> |
| 16 | void fn(T t, const arg& arg) { |
| 17 | oldstylemove obj(arg); |
| 18 | } |
| 19 | |
| 20 | void test() { |
| 21 | fn(1, arg()); |
| 22 | } |
Douglas Gregor | 0b6bc8b | 2010-02-03 09:33:45 +0000 | [diff] [blame] | 23 | |
| 24 | struct X0 { }; |
| 25 | |
| 26 | struct X1 { |
| 27 | explicit X1(const X0 &x0 = X0()); |
| 28 | }; |
| 29 | |
| 30 | template<typename T> |
| 31 | void f0() { |
| 32 | X1 x1; |
| 33 | } |
| 34 | |
| 35 | template void f0<int>(); |
| 36 | template void f0<float>(); |
Douglas Gregor | 67fa05b | 2010-02-05 07:56:11 +0000 | [diff] [blame] | 37 | |
| 38 | struct NonTrivial { |
| 39 | NonTrivial(); |
| 40 | ~NonTrivial(); |
| 41 | }; |
| 42 | |
| 43 | template<int N> void f1() { |
| 44 | NonTrivial array[N]; |
| 45 | } |
| 46 | template<> void f1<2>(); |