This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48010] typedef redefinitions are allowed if the redefined type is a nested class type
- From: "fabien at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Mar 2011 22:37:58 +0000
- Subject: [Bug c++/48010] typedef redefinitions are allowed if the redefined type is a nested class type
- Auto-submitted: auto-generated
- References: <bug-48010-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48010
fabien at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|fabien at gcc dot gnu.org |unassigned at gcc dot
| |gnu.org
--- Comment #3 from fabien at gcc dot gnu.org 2011-03-16 22:37:56 UTC ---
Index: name-lookup.c
===================================================================
--- name-lookup.c (revision 170721)
+++ name-lookup.c (working copy)
@@ -459,7 +459,8 @@ supplement_binding (cxx_binding *binding
&& DECL_ANTICIPATED (bval)
&& !DECL_HIDDEN_FRIEND_P (bval)))
binding->value = decl;
- else if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval))
+ else if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval)
+ && TREE_CODE (decl) != TYPE_DECL)
{
/* The old binding was a type name. It was placed in
VALUE field because it was thought, at the point it was
I've tried the patch above, but it raises another (complicated) issue.
The below reduced testcase no longer compile. While instanciating A<int>, two
decl of 'b' reach push_class_level_binding, and with the patch above, the
second call to supplement_binding no longer succeeds.
template <class>
struct A
{
typedef struct {} b;
};
template class A<int>;
I don't know if we are wrongly instanciating something or if we need to treat
specially a typedef to an anonymous struct in supplement_binding.Unless someone
gives me hint, I give up.