public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/65558 (ICE with abi_tag on anon namespace)
@ 2015-03-25 19:01 Marek Polacek
  2015-03-25 19:24 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Polacek @ 2015-03-25 19:01 UTC (permalink / raw)
  To: GCC Patches, Jason Merrill

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  <polacek@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: C++ PATCH for c++/65558 (ICE with abi_tag on anon namespace)
  2015-03-25 19:01 C++ PATCH for c++/65558 (ICE with abi_tag on anon namespace) Marek Polacek
@ 2015-03-25 19:24 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2015-03-25 19:24 UTC (permalink / raw)
  To: Marek Polacek, GCC Patches

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-25 19:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 19:01 C++ PATCH for c++/65558 (ICE with abi_tag on anon namespace) Marek Polacek
2015-03-25 19:24 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).