Hi,
this is a 4.6/4.7 Regression (the ICE happens also in C++98 mode with
__decltype).
The problem manifest itself as unhandled PTRMEM_CST in
finish_decltype_type, and I'm avoiding it by just handling it like
INTEGER_CST. Is it the correct/best thing to do? Anyway patch passes
testing on x86_64-linux.
Thanks,
Paolo.
//////////////////////
/cp
2011-11-22 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51265
* semantics.c (finish_decltype_type): Handle PTRMEM_CST.
/testsuite
2011-11-22 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/51265
* g++.dg/cpp0x/decltype36.C: New.
Index: testsuite/g++.dg/cpp0x/decltype36.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype36.C (revision 0)
+++ testsuite/g++.dg/cpp0x/decltype36.C (revision 0)
@@ -0,0 +1,21 @@
+// PR c++/51265
+// { dg-options -std=c++0x }
+
+struct Funny
+{
+ int print(int);
+};
+
+template<typename X>
+void c();
+
+template<typename X, X ff>
+void xx()
+{
+ c<decltype(ff)>();
+}
+
+int main()
+{
+ xx<int(Funny::*)(int), &Funny::print>();
+}
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 181627)
+++ cp/semantics.c (working copy)
@@ -5234,6 +5234,7 @@ finish_decltype_type (tree expr, bool id_expressio
case BIT_FIELD_REF:
gcc_unreachable ();
+ case PTRMEM_CST:
case INTEGER_CST:
/* We can get here when the id-expression refers to an
enumerator. */