Hi,
by and large this issue seems already fixed in mainline, ie, we don't
ICE anymore during error recovery, but I noticed that we try to
prettyprint constructor and destructor as expressions and we end up with
ugliness like:
error: taking address of constructor ‘((C<int>*)this)->*A::__ct ’
thus the below, tested x86_64-linux. Ok?
Thanks,
Paolo.
////////////////////
/cp
2017-08-02 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/71440
* typeck.c (build_x_unary_op): Avoid pretty-printing constructor /
destructor as expressions.
/testsuite
2017-08-02 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/71440
* g++.dg/template/crash127.C: New.
Index: cp/typeck.c
===================================================================
--- cp/typeck.c (revision 250787)
+++ cp/typeck.c (working copy)
@@ -5487,9 +5487,9 @@ build_x_unary_op (location_t loc, enum tree_code c
{
if (complain & tf_error)
error (DECL_CONSTRUCTOR_P (fn)
- ? G_("taking address of constructor %qE")
- : G_("taking address of destructor %qE"),
- xarg.get_value ());
+ ? G_("taking address of constructor %qD")
+ : G_("taking address of destructor %qD"),
+ fn);
return error_mark_node;
}
}
Index: testsuite/g++.dg/template/crash127.C
===================================================================
--- testsuite/g++.dg/template/crash127.C (revision 0)
+++ testsuite/g++.dg/template/crash127.C (working copy)
@@ -0,0 +1,22 @@
+// PR c++/71440
+
+struct A
+{
+ void f () {}
+};
+
+typedef void (A::*Ptr) ();
+
+template < Ptr > struct B {};
+
+template < class T >
+struct C : public A
+{
+ void bar ()
+ {
+ B < &A::A > b; // { dg-error "taking address of constructor 'A::A" "" {
target c++98_only } }
+ // { dg-error "taking address of constructor 'constexpr A::A" "" { target
c++11 } .-1 }
+ }
+};
+
+template class C < int >;