> cat bug.ii
template<typename T> T declval();
template<typename T, typename... Args> struct is_constructible {
template<typename T1, typename... Args1>
static decltype(T1(declval<Args1>()...), char()) test();
static const bool value = sizeof(test<T, Args...>()) == 1;
};
template<bool> struct enable_if {
typedef void type;
};
template<class T1, class T2> struct pair {
template<class U2,
class = typename enable_if<is_constructible<T2,
U2&&>::value>::type>
pair(const T1&, U2&&) { }
};
struct string {
string() : p(0) {}
char* p;
};
struct Foo {
string s;
int i;
};
void f() {
pair<int, Foo>(1, Foo());
}
> g++ -g -O2 -std=c++0x bug.ii
bug.ii: In instantiation of const bool is_constructible<Foo, int&&>::value:
bug.ii:24:26: instantiated from here
bug.ii:5:58: internal compiler error: in copy_fn_p, at cp/decl.c:9973
I'm using SVN revision tr...@155658 on linux x86_64.
--
Summary: ICE with -g -O2 -std=c++0x in copy_fn_p, at
cp/decl.c:9973
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wouter dot vermaelen at scarlet dot be
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42634