Hi,
some time ago I looked a bit into this issue: from the diagnostic point
of view, we can probably do better, but we can safely avoid a couple of
ICEs by simply checking the second argument for error_mark_node and by
using get_attribute_name instead of TREE_PURPOSE for an attribute which
may or may not be a C++11 attribute.
Tested x86_64-linux.
Thanks,
Paolo.
///////////////////////
/cp
2014-04-11 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58600
* name-lookup.c (parse_using_directive): Return early if the
attribs argument is error_mark_node; use get_attribute_name.
/testsuite
2014-04-11 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/58600
* g++.dg/cpp0x/gen-attrs-58.C: New.
* g++.dg/cpp0x/gen-attrs-59.C: Likewise.
Index: cp/name-lookup.c
===================================================================
--- cp/name-lookup.c (revision 209275)
+++ cp/name-lookup.c (working copy)
@@ -4019,13 +4019,14 @@ do_using_directive (tree name_space)
void
parse_using_directive (tree name_space, tree attribs)
{
- tree a;
-
do_using_directive (name_space);
- for (a = attribs; a; a = TREE_CHAIN (a))
+ if (attribs == error_mark_node)
+ return;
+
+ for (tree a = attribs; a; a = TREE_CHAIN (a))
{
- tree name = TREE_PURPOSE (a);
+ tree name = get_attribute_name (a);
if (is_attribute_p ("strong", name))
{
if (!toplevel_bindings_p ())
Index: testsuite/g++.dg/cpp0x/gen-attrs-58.C
===================================================================
--- testsuite/g++.dg/cpp0x/gen-attrs-58.C (revision 0)
+++ testsuite/g++.dg/cpp0x/gen-attrs-58.C (working copy)
@@ -0,0 +1,5 @@
+// PR c++/58600
+// { dg-do compile { target c++11 } }
+
+namespace N { int i; }
+using namespace N alignas(int); // { dg-warning "ignored" }
Index: testsuite/g++.dg/cpp0x/gen-attrs-59.C
===================================================================
--- testsuite/g++.dg/cpp0x/gen-attrs-59.C (revision 0)
+++ testsuite/g++.dg/cpp0x/gen-attrs-59.C (working copy)
@@ -0,0 +1,5 @@
+// PR c++/58600
+// { dg-do compile { target c++11 } }
+
+namespace N {}
+using namespace N alignas(X); // { dg-error "declared" }