public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fabien at gcc dot gnu.org" <gcc-bugzilla@gcc.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
Date: Wed, 16 Mar 2011 22:43:00 -0000	[thread overview]
Message-ID: <bug-48010-4-QyYEVowxRe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <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.


  parent reply	other threads:[~2011-03-16 22:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-06 20:38 [Bug c++/48010] New: " fabien at gcc dot gnu.org
2011-03-06 20:42 ` [Bug c++/48010] " fabien at gcc dot gnu.org
2011-03-07 14:05 ` fabien at gcc dot gnu.org
2011-03-16 22:43 ` fabien at gcc dot gnu.org [this message]
2011-05-31 19:13 ` fabien at gcc dot gnu.org
2011-06-02 21:43 ` fabien at gcc dot gnu.org
2011-08-18 11:21 ` dodji at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-48010-4-QyYEVowxRe@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).