re PR c++/85140 (ICE with invalid use of alignas)
authorJakub Jelinek <jakub@redhat.com>
Tue, 3 Apr 2018 16:21:02 +0000 (18:21 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 3 Apr 2018 16:21:02 +0000 (18:21 +0200)
PR c++/85140
* name-lookup.c (handle_namespace_attrs): Return early if attributes
is error_mark_node.

* g++.dg/cpp0x/gen-attrs-64.C: New test.

From-SVN: r259039

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C [new file with mode: 0644]

index 6404a74c36300f47c0cf2fe2b83e81e71230ea9a..d9406bfe962d1818290fe507b3872f49ae68000c 100644 (file)
@@ -1,5 +1,9 @@
 2018-04-03  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/85140
+       * name-lookup.c (handle_namespace_attrs): Return early if attributes
+       is error_mark_node.
+
        PR c++/85134
        * decl.c (cp_finish_decl): If ensure_literal_type_for_constexpr_object
        fails, after clearing DECL_DECLARED_CONSTEXPR_P don't return early,
index 061729a989b67bacdffe39e88c4045e075b26841..9b5db3dc3aa78238f3ba3961c936f41f8d005a33 100644 (file)
@@ -5044,6 +5044,9 @@ handle_namespace_attrs (tree ns, tree attributes)
   tree d;
   bool saw_vis = false;
 
+  if (attributes == error_mark_node)
+    return false;
+
   for (d = attributes; d; d = TREE_CHAIN (d))
     {
       tree name = get_attribute_name (d);
index bcc0714d1070051afb3f3669a09447f500f21287..e2a7cf276cb8a4e2705e3c7ce7396302b20cf548 100644 (file)
@@ -1,5 +1,8 @@
 2018-04-03  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/85140
+       * g++.dg/cpp0x/gen-attrs-64.C: New test.
+
        PR c++/85134
        * g++.dg/gomp/pr85134.C: New test.
        * g++.dg/cpp0x/constexpr-ice19.C: Expect one further error.
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C
new file mode 100644 (file)
index 0000000..c0d48fc
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/85140
+// { dg-do compile { target c++11 } }
+
+namespace N alignas() {}       // { dg-error "expected" }