diff options
author | Volker Reichelt <reichelt@igpm.rwth-aachen.de> | 2006-06-12 21:12:52 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2006-06-12 21:12:52 +0000 |
commit | ff8fe3e0add95082795509f0ecf2e4c25e0f9b99 (patch) | |
tree | e3dc9822f82ad223f8b16f462284414c2dfe1da4 | |
parent | 8bdb09cb0bdd321166269b928f4dcc39d3841c77 (diff) | |
download | gcc-ff8fe3e0add95082795509f0ecf2e4c25e0f9b99.zip gcc-ff8fe3e0add95082795509f0ecf2e4c25e0f9b99.tar.gz gcc-ff8fe3e0add95082795509f0ecf2e4c25e0f9b99.tar.bz2 |
re PR c++/27933 (ICE with invalid "using")
PR c++/27933
* name-lookup.c (lookup_qualified_name): Always return error_mark_node
if lookup fails.
* g++.dg/lookup/using15.C: New test.
From-SVN: r114580
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/using15.C | 10 |
4 files changed, 23 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b1ed4f0..9bc9823 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2006-06-12 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + PR c++/27933 + * name-lookup.c (lookup_qualified_name): Always return error_mark_node + if lookup fails. + PR c++/27951 * decl2.c (finish_anon_union): Return early if build_anon_union_vars fails. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index bf835d7..187a41f 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3713,6 +3713,7 @@ tree lookup_qualified_name (tree scope, tree name, bool is_type_p, bool complain) { int flags = 0; + tree t = NULL_TREE; if (TREE_CODE (scope) == NAMESPACE_DECL) { @@ -3722,17 +3723,14 @@ lookup_qualified_name (tree scope, tree name, bool is_type_p, bool complain) if (is_type_p) flags |= LOOKUP_PREFER_TYPES; if (qualified_lookup_using_namespace (name, scope, &binding, flags)) - return select_decl (&binding, flags); + t = select_decl (&binding, flags); } else if (is_aggr_type (scope, complain)) - { - tree t; - t = lookup_member (scope, name, 2, is_type_p); - if (t) - return t; - } + t = lookup_member (scope, name, 2, is_type_p); - return error_mark_node; + if (!t) + return error_mark_node; + return t; } /* Subroutine of unqualified_namespace_lookup: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b43e519..4b23d39 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2006-06-12 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + PR c++/27933 + * g++.dg/lookup/using15.C: New test. + PR c++/27951 * g++.dg/other/anon4.C: New test. diff --git a/gcc/testsuite/g++.dg/lookup/using15.C b/gcc/testsuite/g++.dg/lookup/using15.C new file mode 100644 index 0000000..b5ca3a8 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using15.C @@ -0,0 +1,10 @@ +// PR c++/27933 +// { dg-do compile } + +template<int> struct A +{ + int i; + A() { using i; } // { dg-error "nested-name-specifier|declared" } +}; + +A<0> a; |