From: Paolo Carlini Date: Thu, 3 Aug 2017 09:26:17 +0000 (+0000) Subject: re PR c++/71440 (ICE on invalid C++ code in instantiate_type, at cp/class.c:8247) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5e691a53fe4d2fd6e437d754fae75c4804c0256;p=gcc.git re PR c++/71440 (ICE on invalid C++ code in instantiate_type, at cp/class.c:8247) /cp 2017-08-03 Paolo Carlini PR c++/71440 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor / destructor as expressions. /testsuite 2017-08-03 Paolo Carlini PR c++/71440 * g++.dg/template/crash127.C: New. From-SVN: r250848 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8be42940bd8..041c6c44bbe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-08-03 Paolo Carlini + + PR c++/71440 + * typeck.c (build_x_unary_op): Avoid pretty-printing constructor / + destructor as expressions. + 2017-08-02 Jakub Jelinek PR c++/81640 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 3dc64045e1a..a58de1d6206 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5487,9 +5487,9 @@ build_x_unary_op (location_t loc, enum tree_code code, cp_expr xarg, { 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; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a8077a53341..58e1b87c6dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-08-03 Paolo Carlini + + PR c++/71440 + * g++.dg/template/crash127.C: New. + 2017-08-03 Jakub Jelinek PR middle-end/81052 diff --git a/gcc/testsuite/g++.dg/template/crash127.C b/gcc/testsuite/g++.dg/template/crash127.C new file mode 100644 index 00000000000..b7c03251f8c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash127.C @@ -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 >;