Hi,
in this 4.8/4.9 Regression, finish_decltype_type doesn't handle
ADDR_EXPR. In 4.7, finish_decltype_type deals with a TEMPLATE_PARM_INDEX
and the testcase compiles fine, but it's quite easy - see c++/52282 - to
trigger the same ICE there too (it would be nice to make progress on the
latter too).
The patchlet below passes testing, not sure whether there is something
deeper about this issue.
Thanks,
Paolo.
/////////////////
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 198381)
+++ cp/semantics.c (working copy)
@@ -5389,6 +5389,7 @@ finish_decltype_type (tree expr, bool id_expressio
case PARM_DECL:
case RESULT_DECL:
case TEMPLATE_PARM_INDEX:
+ case ADDR_EXPR:
expr = mark_type_use (expr);
type = TREE_TYPE (expr);
break;
Index: testsuite/g++.dg/cpp0x/decltype53.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype53.C (revision 0)
+++ testsuite/g++.dg/cpp0x/decltype53.C (working copy)
@@ -0,0 +1,11 @@
+// PR c++/57092
+// { dg-do compile { target c++11 } }
+
+template <void (*F)(int)>
+class B {
+ decltype(F) v;
+};
+
+void foo(int) {}
+
+B<foo> o;