Commit c7fc15f5 by Nathan Sidwell

[pr84733] Fix ICE popping local scope

	PR c++/84733
	* name-lookup.c (do_pushdecl): Look through cleanp levels.
parent ccacf77b
2020-03-27 Nathan Sidwell <nathan@acm.org>
PR c++/84733
* name-lookup.c (do_pushdecl): Look through cleanp levels.
2020-03-27 Martin Sebor <msebor@redhat.com>
PR c++/94078
......
......@@ -2998,7 +2998,8 @@ do_pushdecl (tree decl, bool is_friend)
/* The binding level we will be pushing into. During local class
pushing, we want to push to the containing scope. */
cp_binding_level *level = current_binding_level;
while (level->kind == sk_class)
while (level->kind == sk_class
|| level->kind == sk_cleanup)
level = level->level_chain;
/* An anonymous namespace has a NULL DECL_NAME, but we still want to
......
// { dg-do compile { target c++11 } }
// PR c++/84733 ICE popping local binding after cleanup region
struct c {
~c();
} b;
void f() {
#ifndef OK
try {
d:
;
} catch (int) {
}
#endif
decltype(b) a;
int e;
struct e { } f;
e = 5;
struct e j;
}
// { dg-do compile { target c++11 } }
// PR94257 ICE with silly inline nest.
inline namespace B { // { dg-message "namespace B { }" }
namespace B { } // { dg-message "namespace B::B { }" }
}
namespace B { // { dg-error ".namespace B. is ambiguous" }
}
// But this is fine
namespace D {
inline namespace D { }
}
namespace D {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment