public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48010] New: typedef redefinitions are allowed if the redefined type is a nested class type
@ 2011-03-06 20:38 fabien at gcc dot gnu.org
  2011-03-06 20:42 ` [Bug c++/48010] " fabien at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-03-06 20:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48010

           Summary: typedef redefinitions are allowed if the redefined
                    type is a nested class type
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: fabien@gcc.gnu.org
        ReportedBy: fabien@gcc.gnu.org
              Host: x86_64-unknown-linux-gnu
            Target: x86_64-unknown-linux-gnu
             Build: x86_64-unknown-linux-gnu


struct A
{
    struct type {};
    typedef int type;
};


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48010] typedef redefinitions are allowed if the redefined type is a nested class type
  2011-03-06 20:38 [Bug c++/48010] New: typedef redefinitions are allowed if the redefined type is a nested class type fabien at gcc dot gnu.org
@ 2011-03-06 20:42 ` fabien at gcc dot gnu.org
  2011-03-07 14:05 ` fabien at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-03-06 20:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48010

fabien at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.03.06 20:42:33
     Ever Confirmed|0                           |1
      Known to fail|                            |4.1.2, 4.2.4, 4.3.5, 4.4.5,
                   |                            |4.5.2

--- Comment #1 from fabien at gcc dot gnu.org 2011-03-06 20:42:33 UTC ---
Jason confirmed it while discussing about PR 26256. Mine.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48010] typedef redefinitions are allowed if the redefined type is a nested class type
  2011-03-06 20:38 [Bug c++/48010] New: typedef redefinitions are allowed if the redefined type is a nested class type 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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-03-07 14:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48010

fabien at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |3.2.3
      Known to fail|                            |3.4.6

--- Comment #2 from fabien at gcc dot gnu.org 2011-03-07 14:05:19 UTC ---
It is a regression from 3.2.3 where the following diagnostic was emitted:

duplicate nested type `A::type'


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48010] typedef redefinitions are allowed if the redefined type is a nested class type
  2011-03-06 20:38 [Bug c++/48010] New: typedef redefinitions are allowed if the redefined type is a nested class type 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
  2011-05-31 19:13 ` fabien at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-03-16 22:43 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48010] typedef redefinitions are allowed if the redefined type is a nested class type
  2011-03-06 20:38 [Bug c++/48010] New: typedef redefinitions are allowed if the redefined type is a nested class type fabien at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-03-16 22:43 ` fabien at gcc dot gnu.org
@ 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
  5 siblings, 0 replies; 7+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-05-31 19:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48010

--- Comment #4 from fabien at gcc dot gnu.org 2011-05-31 19:02:22 UTC ---
Author: fabien
Date: Tue May 31 19:02:19 2011
New Revision: 174506

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174506
Log:
gcc/cp/ChangeLog

2010-05-31  Fabien Chene  <fabien@gcc.gnu.org>

    PR c++/48010
    * name-lookup.c (supplement_binding_1): If the old binding was a
    type name, also check that the DECL actually refers to the same
    type or is not a type.

gcc/testsuite/ChangeLog

2010-05-31  Fabien Chene  <fabien@gcc.gnu.org>

    PR c++/48010
    * g++.dg/lookup/name-clash9.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/lookup/name-clash9.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48010] typedef redefinitions are allowed if the redefined type is a nested class type
  2011-03-06 20:38 [Bug c++/48010] New: typedef redefinitions are allowed if the redefined type is a nested class type fabien at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-06-02 21:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48010

fabien at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from fabien at gcc dot gnu.org 2011-06-02 21:43:15 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/48010] typedef redefinitions are allowed if the redefined type is a nested class type
  2011-03-06 20:38 [Bug c++/48010] New: typedef redefinitions are allowed if the redefined type is a nested class type fabien at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-06-02 21:43 ` fabien at gcc dot gnu.org
@ 2011-08-18 11:21 ` dodji at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-08-18 11:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48010

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marc.glisse at normalesup
                   |                            |dot org

--- Comment #6 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-08-18 11:19:27 UTC ---
*** Bug 32997 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-18 11:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-06 20:38 [Bug c++/48010] New: typedef redefinitions are allowed if the redefined type is a nested class type 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
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

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).