re PR c++/65558 (crash using __attribute__((__abi_tag__)) on anonymous inline namespace)
authorMarek Polacek <polacek@redhat.com>
Wed, 25 Mar 2015 20:08:05 +0000 (20:08 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 25 Mar 2015 20:08:05 +0000 (20:08 +0000)
PR c++/65558
* name-lookup.c (handle_namespace_attrs): Ignore abi_tag attribute
on an anonymous namespace.

* g++.dg/cpp0x/pr65558.C: New test.

From-SVN: r221672

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

index 65e1912cf07ecf9044f1b6c1649c27a0b986bcc9..4ba45d72c6acda156a3a406dcf94bfc392c18351 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-25  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/65558
+       * name-lookup.c (handle_namespace_attrs): Ignore abi_tag attribute
+       on an anonymous namespace.
+
 2015-03-25  Marek Polacek  <polacek@redhat.com>
 
        PR c++/61670
index b85fbc98b633c984f553b79d64201fd23af0a067..4303ed5fb1fbb50d227e448fa18a8ea889d0a92c 100644 (file)
@@ -3663,6 +3663,12 @@ handle_namespace_attrs (tree ns, tree attributes)
                       "namespace", name);
              continue;
            }
+         if (!DECL_NAME (ns))
+           {
+             warning (OPT_Wattributes, "ignoring %qD attribute on anonymous "
+                      "namespace", name);
+             continue;
+           }
          if (!args)
            {
              tree dn = DECL_NAME (ns);
index c8f9033896663b0d1b71267afe5876c97ea4afdb..68534fc4e6a9bce4ebee1eae34f59cf27d637e83 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-25  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/65558
+       * g++.dg/cpp0x/pr65558.C: New test.
+
 2015-03-25  Marek Polacek  <polacek@redhat.com>
 
        PR c++/61670
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr65558.C b/gcc/testsuite/g++.dg/cpp0x/pr65558.C
new file mode 100644 (file)
index 0000000..5437e50
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/65558
+// { dg-do compile { target c++11 } }
+
+inline namespace __attribute__((__abi_tag__))
+{ // { dg-warning "ignoring .__abi_tag__. attribute on anonymous namespace" }
+}