* C++ PATCH for c++/50742 (ICE on switch with local using-decl)
@ 2011-10-18 18:10 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2011-10-18 18:10 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 162 bytes --]
A using-declaration adds a TREE_LIST to the list of names on a binding
level, so we need to cope with that here.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 50742.patch --]
[-- Type: text/x-patch, Size: 1088 bytes --]
commit 052e893fe307f33ca3d3c2ead06248e0ef738f16
Author: Jason Merrill <jason@redhat.com>
Date: Mon Oct 17 22:04:08 2011 -0400
PR c++/50742
* decl.c (check_previous_goto_1): Handle using-decl.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8b5033f..4b5b6c8 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2683,7 +2683,8 @@ check_previous_goto_1 (tree decl, cp_binding_level* level, tree names,
tree new_decls, old_decls = (b == level ? names : NULL_TREE);
for (new_decls = b->names; new_decls != old_decls;
- new_decls = DECL_CHAIN (new_decls))
+ new_decls = (DECL_P (new_decls) ? DECL_CHAIN (new_decls)
+ : TREE_CHAIN (new_decls)))
{
int problem = decl_jump_unsafe (new_decls);
if (! problem)
diff --git a/gcc/testsuite/g++.dg/lookup/using23.C b/gcc/testsuite/g++.dg/lookup/using23.C
new file mode 100644
index 0000000..5dd8d85
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using23.C
@@ -0,0 +1,13 @@
+// PR c++/50742
+
+typedef int A;
+
+void f(int i)
+{
+ switch (i)
+ {
+ case 0:
+ using ::A;
+ default:;
+ }
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-10-18 17:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-18 18:10 C++ PATCH for c++/50742 (ICE on switch with local using-decl) 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).