re PR c++/85014 (internal compiler error: in lookup_base, at cp/search.c:185)
authorPaolo Carlini <paolo@gcc.gnu.org>
Mon, 18 Mar 2019 09:38:27 +0000 (09:38 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 18 Mar 2019 09:38:27 +0000 (09:38 +0000)
/cp
2019-03-18  Paolo Carlini  <paolo.carlini@oracle.com>

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  <paolo.carlini@oracle.com>

PR c++/85014
* g++.dg/cpp0x/pr85014.C: New.

From-SVN: r269759

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr85014.C [new file with mode: 0644]

index 34e9c79ef2a667d726e06ff3e8f360d465a3e78f..fa569bc1a611f41c04a3b8d8b04bd0b5d7e55173 100644 (file)
@@ -1,3 +1,10 @@
+2019-03-18  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       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  <jason@redhat.com>
 
        PR c++/89571 - ICE with ill-formed noexcept on constructor.
index fcf06061bc724963b33ffc1c6686aee81d50c5bd..599e0e39d4e9d6708d2ae2ddae7568ab51da2143 100644 (file)
@@ -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);
     }
 
index 585cba50d97c19de06d345ca0f30a4f723f034c2..30014e6ed28d85f778a63a16cef66042a55fc9a4 100644 (file)
@@ -1,3 +1,8 @@
+2019-03-18  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/85014
+       * g++.dg/cpp0x/pr85014.C: New.
+
 2019-03-18  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/86979
 2019-03-17  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        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  <danglin@gcc.gnu.org>
 
-       * 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 (file)
index 0000000..0a3b241
--- /dev/null
@@ -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" }