re PR c++/84707 (internal compiler error: Segmentation fault (tree_check()/duplicate_...
authorMarek Polacek <polacek@redhat.com>
Mon, 5 Mar 2018 16:15:35 +0000 (16:15 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 5 Mar 2018 16:15:35 +0000 (16:15 +0000)
PR c++/84707
* decl.c (duplicate_decls): Check DECL_NAME before accessing
UDLIT_OPER_P.

* g++.dg/cpp0x/inline-ns10.C: New test.

From-SVN: r258255

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/inline-ns10.C [new file with mode: 0644]

index 6c37dc3eabb0b0a8438a695de6f83cb551a612ff..001cb6a559ae8dc7bcad9dd1774ae6b90d8bf905 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-05  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/84707
+       * decl.c (duplicate_decls): Check DECL_NAME before accessing
+       UDLIT_OPER_P.
+
 2018-03-05  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/84694
index 1866e8f357423b07dd82c1dc03ca2ec48309e86f..b2e19a6549d10e967cea3d775be121d09e2ba4af 100644 (file)
@@ -1410,7 +1410,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
       || TREE_TYPE (olddecl) == error_mark_node)
     return error_mark_node;
 
-  if (UDLIT_OPER_P (DECL_NAME (newdecl))
+  if (DECL_NAME (newdecl)
+      && DECL_NAME (olddecl)
+      && UDLIT_OPER_P (DECL_NAME (newdecl))
       && UDLIT_OPER_P (DECL_NAME (olddecl)))
     {
       if (TREE_CODE (newdecl) == TEMPLATE_DECL
index 934339d97f705aacb5b965dcf9166053e2fe0fc4..a1f72cb705b98e040e997e151654be59c6402b85 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-05  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/84707
+       * g++.dg/cpp0x/inline-ns10.C: New test.
+
 2018-03-05  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/84694
diff --git a/gcc/testsuite/g++.dg/cpp0x/inline-ns10.C b/gcc/testsuite/g++.dg/cpp0x/inline-ns10.C
new file mode 100644 (file)
index 0000000..3ab425f
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/84707
+// { dg-do compile { target c++11 } }
+
+inline namespace {
+  namespace {}
+}
+
+namespace {} // { dg-error "conflicts" }