From: Paolo Carlini Date: Mon, 18 Mar 2019 09:38:27 +0000 (+0000) Subject: re PR c++/85014 (internal compiler error: in lookup_base, at cp/search.c:185) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6da0bf1f15cdb0d641b77af75b7cb511ef9b553;p=gcc.git re PR c++/85014 (internal compiler error: in lookup_base, at cp/search.c:185) /cp 2019-03-18 Paolo Carlini PR c++/85014 * semantics.c (finish_non_static_data_member): Check return value of context_for_name_lookup and immediately return error_mark_node if isn't a type. /testsuite 2019-03-18 Paolo Carlini PR c++/85014 * g++.dg/cpp0x/pr85014.C: New. From-SVN: r269759 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 34e9c79ef2a..fa569bc1a61 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2019-03-18 Paolo Carlini + + PR c++/85014 + * semantics.c (finish_non_static_data_member): Check return value + of context_for_name_lookup and immediately return error_mark_node + if isn't a type. + 2019-03-17 Jason Merrill PR c++/89571 - ICE with ill-formed noexcept on constructor. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index fcf06061bc7..599e0e39d4e 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1828,7 +1828,15 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope) { tree scope = qualifying_scope; if (scope == NULL_TREE) - scope = context_for_name_lookup (decl); + { + scope = context_for_name_lookup (decl); + if (!TYPE_P (scope)) + { + /* Can happen during error recovery (c++/85014). */ + gcc_assert (seen_error ()); + return error_mark_node; + } + } object = maybe_dummy_object (scope, NULL); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 585cba50d97..30014e6ed28 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-18 Paolo Carlini + + PR c++/85014 + * g++.dg/cpp0x/pr85014.C: New. + 2019-03-18 Jakub Jelinek PR middle-end/86979 @@ -6,11 +11,12 @@ 2019-03-17 Thomas Koenig PR fortran/88008 - * gfortran.dg/typebound_call_31.f90: New test. + * gfortran.dg/typebound_call_31.f90: New test. 2019-03-03-17 John David Anglin - * gcc.dg/compat/pr83487-1_x.c: Use -fno-common option on hppa*-*-hpux*. + * gcc.dg/compat/pr83487-1_x.c: Use -fno-common option on + hppa*-*-hpux*. * gcc.dg/compat/pr83487-1_y.c: Likewise. * gfortran.dg/pointer_init_10.f90: Require visibility support. diff --git a/gcc/testsuite/g++.dg/cpp0x/pr85014.C b/gcc/testsuite/g++.dg/cpp0x/pr85014.C new file mode 100644 index 00000000000..0a3b241cebd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr85014.C @@ -0,0 +1,10 @@ +// { dg-do compile { target c++11 } } +// { dg-options "" } + +struct { + short a[__builtin_constant_p([] { + struct { + int b = b; + }; // { dg-error "abstract declarator" } + })]; +}; // { dg-error "abstract declarator" }