Debian Codegraph @

gcc/testsuite/g++.dg/other/crash-6.C

raw
1 // Origin: PR c++/42634
2 // { dg-options "-g" }
3 // { dg-do compile { target c++11 } }
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