From: Paolo Carlini Date: Mon, 24 Sep 2018 17:42:45 +0000 (+0000) Subject: re PR c++/85070 (ICE on C++ code: in lazily_declare_fn, at cp/method.c:2409) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=06ff274feb26fd569fd167225d29479f5b974c45;p=gcc.git re PR c++/85070 (ICE on C++ code: in lazily_declare_fn, at cp/method.c:2409) /cp 2018-09-24 Paolo Carlini PR c++/85070 * method.c (lazily_declare_fn): During error-recovery add_method may return false. /testsuite 2018-09-24 Paolo Carlini PR c++/85070 * g++.dg/cpp0x/pr85070.C: New. From-SVN: r264541 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 079d1cb8574..6d4e93b3a24 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-09-24 Paolo Carlini + + PR c++/85070 + * method.c (lazily_declare_fn): During error-recovery add_method + may return false. + 2018-09-21 Marek Polacek PR c++/87372 - __func__ constexpr evaluation. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index d75dacb1373..5379b4d3d09 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2421,7 +2421,7 @@ lazily_declare_fn (special_function_kind sfk, tree type) /* Add it to the class */ bool added = add_method (type, fn, false); - gcc_assert (added); + gcc_assert (added || errorcount); /* Add it to TYPE_FIELDS. */ if (sfk == sfk_destructor diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b98b6ebf79b..224317927ce 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-24 Paolo Carlini + + PR c++/85070 + * g++.dg/cpp0x/pr85070.C: New. + 2018-09-24 H.J. Lu PR target/82699 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr85070.C b/gcc/testsuite/g++.dg/cpp0x/pr85070.C new file mode 100644 index 00000000000..c1c5b23fd81 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr85070.C @@ -0,0 +1,13 @@ +// { dg-do compile { target c++11 } } + +struct A; + +struct B +{ + constexpr A & operator= (const A &); // { dg-warning "used" "" { target c++14_only } } +}; + +struct A : B // { dg-error "cannot be overloaded" "" { target c++14_only } } +{ + using B::operator=; +} a { a = a };