OSDN Git Service

PR c++/55058
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / other / crash-6.C
1 // Origin: PR c++/42634
2 // { dg-options "-g -std=c++0x" }
3 // { dg-do compile }
4
5 template<typename T> T declval();
6
7 template<typename T, typename... Args> struct is_constructible {
8     template<typename T1, typename... Args1> static decltype(T1(declval<Args1>()...), char()) test();
9     static const bool value = sizeof(test<T, Args...>()) == 1;
10 };
11 template<bool> struct enable_if {
12         typedef void type;
13 };
14 template<class T1, class T2> struct pair {
15     template<class U2,
16              class = typename enable_if<is_constructible<T2,U2&&>::value>::type
17              >
18     pair(const T1&, U2&&) { }
19 };
20 struct string {
21   string() : p(0) {}
22   char* p;
23 };
24
25 struct Foo {
26   string s;
27   int i;
28 };
29
30 void f()
31 {
32   pair<int, Foo>(1, Foo());
33 }
34