Commit 364f9c6b by Jason Merrill Committed by Jason Merrill

re PR c++/42010 ([C++0x] ICE: lang_* check: failed in…

re PR c++/42010 ([C++0x] ICE: lang_* check: failed in discriminator_for_local_entity, at cp/mangle.c:1581)

	PR c++/42010
	* cp-tree.h (DECL_DISCRIMINATOR_SET_P): New.
	* mangle.c (discriminator_for_local_entity): Check it.

From-SVN: r155007
parent b50eb277
2009-12-04 Jason Merrill <jason@redhat.com> 2009-12-04 Jason Merrill <jason@redhat.com>
PR c++/42010
* cp-tree.h (DECL_DISCRIMINATOR_SET_P): New.
* mangle.c (discriminator_for_local_entity): Check it.
PR c++/42277 PR c++/42277
* semantics.c (finish_decltype_type): Defer handling of decltype * semantics.c (finish_decltype_type): Defer handling of decltype
of a non-dependent COMPONENT_REF in a template. of a non-dependent COMPONENT_REF in a template.
......
...@@ -2052,6 +2052,10 @@ struct GTY(()) lang_decl { ...@@ -2052,6 +2052,10 @@ struct GTY(()) lang_decl {
/* Discriminator for name mangling. */ /* Discriminator for name mangling. */
#define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator) #define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
/* True iff DECL_DISCRIMINATOR is set for a DECL_DISCRIMINATOR_P decl. */
#define DECL_DISCRIMINATOR_SET_P(NODE) \
(DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->u.base.u2sel == 1)
/* The index of a user-declared parameter in its function, starting at 1. /* The index of a user-declared parameter in its function, starting at 1.
All artificial parameters will have index 0. */ All artificial parameters will have index 0. */
#define DECL_PARM_INDEX(NODE) \ #define DECL_PARM_INDEX(NODE) \
......
...@@ -1577,11 +1577,11 @@ discriminator_for_local_entity (tree entity) ...@@ -1577,11 +1577,11 @@ discriminator_for_local_entity (tree entity)
{ {
if (DECL_DISCRIMINATOR_P (entity)) if (DECL_DISCRIMINATOR_P (entity))
{ {
if (DECL_LANG_SPECIFIC (entity)) if (DECL_DISCRIMINATOR_SET_P (entity))
return DECL_DISCRIMINATOR (entity); return DECL_DISCRIMINATOR (entity);
else else
/* The first entity with a particular name doesn't get /* The first entity with a particular name doesn't get
DECL_LANG_SPECIFIC/DECL_DISCRIMINATOR. */ DECL_DISCRIMINATOR set up. */
return 0; return 0;
} }
else if (TREE_CODE (entity) == TYPE_DECL) else if (TREE_CODE (entity) == TYPE_DECL)
......
2009-12-04 Jason Merrill <jason@redhat.com> 2009-12-04 Jason Merrill <jason@redhat.com>
PR c++/42010
* g++.dg/abi/local2.C: New.
PR c++/42277 PR c++/42277
* g++.dg/cpp0x/decltype20.C: New. * g++.dg/cpp0x/decltype20.C: New.
......
// PR c++/42010
// { dg-final { scan-assembler "ZZN1A1fEvE1s" } }
struct A {
static int f()
{
static struct {
int i;
} s;
return s.i;
}
};
int main()
{
return A::f();
}
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