===================================================================
@@ -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>();
+}
===================================================================
@@ -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. */