blob: 9658fc1465cd87f6ed50e21566aa440d70220cb1 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Andy Gibbs8e8fb3b2012-10-19 12:44:48 +00002// expected-no-diagnostics
Sebastian Redl42dddbe2009-11-08 10:16:43 +00003
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.
7struct arg {
8 arg();
9};
10
11struct oldstylemove {
12 oldstylemove(oldstylemove&);
13 oldstylemove(const arg&);
14};
15
16template <typename T>
17void fn(T t, const arg& arg) {
18 oldstylemove obj(arg);
19}
20
21void test() {
22 fn(1, arg());
23}
Douglas Gregor0b6bc8b2010-02-03 09:33:45 +000024
25struct X0 { };
26
27struct X1 {
28 explicit X1(const X0 &x0 = X0());
29};
30
31template<typename T>
32void f0() {
33 X1 x1;
34}
35
36template void f0<int>();
37template void f0<float>();
Douglas Gregor67fa05b2010-02-05 07:56:11 +000038
39struct NonTrivial {
40 NonTrivial();
41 ~NonTrivial();
42};
43
44template<int N> void f1() {
45 NonTrivial array[N];
46}
47template<> void f1<2>();