Re: C++ PATCH for c++/65558 (ICE with abi_tag on anon namespace)

2015-03-25 Thread Jason Merrill

OK.

Jason


C++ PATCH for c++/65558 (ICE with abi_tag on anon namespace)

2015-03-25 Thread Marek Polacek
As discussed in the PR, the abi_tag on an anonymous namespace is useless,
but we shouldn't ICE if the user attempts to do that.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2015-03-25  Marek Polacek  pola...@redhat.com

PR c++/65558
* name-lookup.c (handle_namespace_attrs): Ignore abi_tag attribute
on an anonymous namespace.

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

diff --git gcc/cp/name-lookup.c gcc/cp/name-lookup.c
index b85fbc9..4303ed5 100644
--- gcc/cp/name-lookup.c
+++ gcc/cp/name-lookup.c
@@ -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);
diff --git gcc/testsuite/g++.dg/cpp0x/pr65558.C 
gcc/testsuite/g++.dg/cpp0x/pr65558.C
index e69de29..5437e50 100644
--- gcc/testsuite/g++.dg/cpp0x/pr65558.C
+++ gcc/testsuite/g++.dg/cpp0x/pr65558.C
@@ -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 }
+}

Marek