The following reduced program produces an ICE when compiled with
-std=c++0x -O2 -g.
=====================================================
struct X {
void func() {}
};
template<typename T, typename U = decltype(&T::func)>
void b(T) {}
int main() {
b(X()); /* line 9 */
X().func();
return 0;
}
=====================================================
1.cc: In function 'void b(T) [with T = X, U = void (X::*)()]':
1.cc:9:9: internal compiler error: in build_ptrmem_type, at cp/decl.c:7202
And the following variation produces a different ICE.
===================================================
struct X {
void func() {}
};
template<typename T, typename = decltype(&T::func)>
struct A {};
template<typename T>
void b(T) {}
int main() {
b(A<X>());
X().func();
return 0;
}
===================================================
Internal compiler error: Error reporting routines re-entered.
--
Summary: [c++0x] ICE with pointer-to-member-function decltype
argument in template function
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: aaz at althenia dot net
GCC build triplet: x86_64-portbld-freebsd8.0
GCC host triplet: x86_64-portbld-freebsd8.0
GCC target triplet: x86_64-portbld-freebsd8.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42336