From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31531 invoked by alias); 16 Mar 2011 22:38:05 -0000 Received: (qmail 31387 invoked by uid 22791); 16 Mar 2011 22:38:03 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Mar 2011 22:37:59 +0000 From: "fabien at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/48010] typedef redefinitions are allowed if the redefined type is a nested class type X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: fabien at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: AssignedTo Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 16 Mar 2011 22:43:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg01762.txt.bz2 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, two decl of 'b' reach push_class_level_binding, and with the patch above, the second call to supplement_binding no longer succeeds. template struct A { typedef struct {} b; }; template class A; 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.