Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Sebastian Redl | 42dddbe | 2009-11-08 10:16:43 +0000 | [diff] [blame] | 3 | |
| 4 | // PR5426 - the non-dependent obj would be fully processed and wrapped in a |
| 5 | // CXXConstructExpr at definition time, which would lead to a failure at |
| 6 | // instantiation time. |
| 7 | struct arg { |
| 8 | arg(); |
| 9 | }; |
| 10 | |
| 11 | struct oldstylemove { |
| 12 | oldstylemove(oldstylemove&); |
| 13 | oldstylemove(const arg&); |
| 14 | }; |
| 15 | |
| 16 | template <typename T> |
| 17 | void fn(T t, const arg& arg) { |
| 18 | oldstylemove obj(arg); |
| 19 | } |
| 20 | |
| 21 | void test() { |
| 22 | fn(1, arg()); |
| 23 | } |
Douglas Gregor | 0b6bc8b | 2010-02-03 09:33:45 +0000 | [diff] [blame] | 24 | |
| 25 | struct X0 { }; |
| 26 | |
| 27 | struct X1 { |
| 28 | explicit X1(const X0 &x0 = X0()); |
| 29 | }; |
| 30 | |
| 31 | template<typename T> |
| 32 | void f0() { |
| 33 | X1 x1; |
| 34 | } |
| 35 | |
| 36 | template void f0<int>(); |
| 37 | template void f0<float>(); |
Douglas Gregor | 67fa05b | 2010-02-05 07:56:11 +0000 | [diff] [blame] | 38 | |
| 39 | struct NonTrivial { |
| 40 | NonTrivial(); |
| 41 | ~NonTrivial(); |
| 42 | }; |
| 43 | |
| 44 | template<int N> void f1() { |
| 45 | NonTrivial array[N]; |
| 46 | } |
| 47 | template<> void f1<2>(); |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 48 | |
| 49 | namespace PR20346 { |
| 50 | struct S { short inner_s; }; |
| 51 | |
| 52 | struct outer_struct { |
| 53 | wchar_t arr[32]; |
| 54 | S outer_s; |
| 55 | }; |
| 56 | |
| 57 | template <class T> |
| 58 | void OpenFileSession() { |
| 59 | // Ensure that we don't think the ImplicitValueInitExpr generated here |
| 60 | // during the initial parse only initializes the first array element! |
| 61 | outer_struct asdfasdf = {}; |
| 62 | }; |
| 63 | |
| 64 | void foo() { |
| 65 | OpenFileSession<int>(); |
| 66 | } |
| 67 | } |