public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected
@ 2004-10-21 20:57 reichelt at gcc dot gnu dot org
  2004-10-21 21:02 ` [Bug c++/18100] " pinskia at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-10-21 20:57 UTC (permalink / raw)
  To: gcc-bugs

The following invalid code snippet is accepted since gcc 3.4.0:

================================
struct A
{
    template<int> struct A {};
};

A::A<0> a;
================================

-- 
           Summary: [3.4/4.0 regression] template member with same name as
                    class not rejected
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
@ 2004-10-21 21:02 ` pinskia at gcc dot gnu dot org
  2004-11-01  0:46 ` mmitchel at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-21 21:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-21 21:02 -------
: Search converges between 2004-02-01-trunk (#445) and 2004-03-01-trunk (#446).
: Search converges between 2004-02-02-3.4 (#1) and 2004-03-01-3.4 (#2).


A very recent (meaning close to right after 3.4 branch) regression.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-21 21:02:07
               date|                            |
   Target Milestone|---                         |3.4.3


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
  2004-10-21 21:02 ` [Bug c++/18100] " pinskia at gcc dot gnu dot org
@ 2004-11-01  0:46 ` mmitchel at gcc dot gnu dot org
  2004-11-16 10:05 ` reichelt at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-01  0:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-11-01 00:46 -------
Postponed until GCC 3.4.4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.3                       |3.4.4


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
  2004-10-21 21:02 ` [Bug c++/18100] " pinskia at gcc dot gnu dot org
  2004-11-01  0:46 ` mmitchel at gcc dot gnu dot org
@ 2004-11-16 10:05 ` reichelt at gcc dot gnu dot org
  2004-11-16 20:35 ` reichelt at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-16 10:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-11-16 10:05 -------
On mainline we now have an ICE:

PR18100.cc:3: error: 'A' is not a template type
PR18100.cc:3: internal compiler error: in xref_basetypes, at cp/decl.c:9364
Please submit a full bug report, [etc.]


-- 


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-11-16 10:05 ` reichelt at gcc dot gnu dot org
@ 2004-11-16 20:35 ` reichelt at gcc dot gnu dot org
  2004-11-16 21:08 ` reichelt at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-16 20:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-11-16 20:35 -------
At least we have an error message now.
But the error message isn't quite correct.
The 3.3 branch gives a better one:

PR18100.cc:2: error: duplicate nested type `struct A'

Kriang, the ICE was introduced with your name-lookup patch
http://gcc.gnu.org/ml/gcc-cvs/2004-11/msg00680.html
Maybe you want to have a look at this one.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lerdsuwa at gcc dot gnu dot
                   |                            |org
           Keywords|                            |error-recovery, ice-on-
                   |                            |invalid-code
      Known to fail|                            |3.4.0 3.4.3 4.0.0
      Known to work|                            |3.3.5


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-11-16 20:35 ` reichelt at gcc dot gnu dot org
@ 2004-11-16 21:08 ` reichelt at gcc dot gnu dot org
  2004-12-04  7:34 ` lerdsuwa at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-16 21:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-11-16 21:08 -------
Another hint: The accepts-invalid bug was introduced by Mark's patch for
PR14086:
http://gcc.gnu.org/ml/gcc-cvs/2004-02/msg00790.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-11-16 21:08 ` reichelt at gcc dot gnu dot org
@ 2004-12-04  7:34 ` lerdsuwa at gcc dot gnu dot org
  2004-12-06 10:26 ` lerdsuwa at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-04  7:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-12-04 07:34 -------
Got it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |lerdsuwa at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-12-04  7:34 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-06 10:26 ` lerdsuwa at gcc dot gnu dot org
  2004-12-07 12:35 ` lerdsuwa at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-06 10:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-12-06 10:25 -------
Patch for 4.0 submitted:
  http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00388.html

Patch for 3.4 in progress.


-- 


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-12-06 10:26 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-07 12:35 ` lerdsuwa at gcc dot gnu dot org
  2004-12-08  5:48 ` mark at codesourcery dot com
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-07 12:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-12-07 12:34 -------
Patch for 3.4 is submitted:
  http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00450.html


-- 


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-12-07 12:35 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-08  5:48 ` mark at codesourcery dot com
  2004-12-08  9:05 ` nathan at codesourcery dot com
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mark at codesourcery dot com @ 2004-12-08  5:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2004-12-08 05:48 -------
Subject: Re:  [3.4/4.0 regression] template member with same
 name as class not rejected

lerdsuwa at gcc dot gnu dot org wrote:
> ------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-12-07 12:34 -------
> Patch for 3.4 is submitted:
>   http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00450.html

(There is a typo in your test case; you meant "nested" instead of "ested".)

That aside, I'm concerned that this fix might cause something else to 
break, and, given that the problem is only a missed diagnostic, I do not 
think that's a good tradeoff.  Nathan, what do you think?



-- 


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-12-08  5:48 ` mark at codesourcery dot com
@ 2004-12-08  9:05 ` nathan at codesourcery dot com
  2004-12-08 10:13 ` lerdsuwa at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: nathan at codesourcery dot com @ 2004-12-08  9:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at codesourcery dot com  2004-12-08 09:05 -------
Subject: Re:  [3.4/4.0 regression] template member with same
 name as class not rejected

Mark Mitchell wrote:
> lerdsuwa at gcc dot gnu dot org wrote:
> 
>> ------- Additional Comments From lerdsuwa at gcc dot gnu dot org  
>> 2004-12-07 12:34 -------
>> Patch for 3.4 is submitted:
>>   http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00450.html
> 
> 
> (There is a typo in your test case; you meant "nested" instead of "ested".)
> 
> That aside, I'm concerned that this fix might cause something else to 
> break, and, given that the problem is only a missed diagnostic, I do not 
> think that's a good tradeoff.  Nathan, what do you think?

Does this allow templated ctors? If those are still permitted, I think
the patch is ok.

(IMO it would be simpler to check those things
that are allowed to have the same name, rather than all those that aren't.
That would not be a sensible 3.4 change though.)



nathan



-- 


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2004-12-08  9:05 ` nathan at codesourcery dot com
@ 2004-12-08 10:13 ` lerdsuwa at gcc dot gnu dot org
  2004-12-08 10:25 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-08 10:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-12-08 10:12 -------
push_class_level_binding is never called for ctors and dtors
because of a login in add_method.  So my patch doesn't affect
template ctor.

-- 


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2004-12-08 10:13 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-08 10:25 ` cvs-commit at gcc dot gnu dot org
  2004-12-08 10:54 ` cvs-commit at gcc dot gnu dot org
  2004-12-08 10:56 ` lerdsuwa at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-08 10:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-08 10:25 -------
Subject: Bug 18100

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	lerdsuwa@gcc.gnu.org	2004-12-08 10:25:23

Modified files:
	gcc/cp         : ChangeLog decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/lookup: name-clash4.C 

Log message:
	PR c++/18100
	* decl.c (lookup_and_check_tag): Diagnose nested class with
	the same name as enclosing class.
	
	* g++.dg/lookup/name-clash4.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4520&r2=1.4521
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1339&r2=1.1340
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4723&r2=1.4724
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/name-clash4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2004-12-08 10:25 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-08 10:54 ` cvs-commit at gcc dot gnu dot org
  2004-12-08 10:56 ` lerdsuwa at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-08 10:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-08 10:54 -------
Subject: Bug 18100

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	lerdsuwa@gcc.gnu.org	2004-12-08 10:53:30

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

Log message:
	PR c++/18100
	* name-lookup.c (push_class_level_binding): Diagnose nested
	class template with the same name as enclosing class.
	
	* g++.dg/lookup/name-clash4.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.182&r2=1.3892.2.183
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.34.2.19&r2=1.34.2.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.319&r2=1.3389.2.320
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/name-clash4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/18100] [3.4/4.0 regression] template member with same name as class not rejected
  2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2004-12-08 10:54 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-08 10:56 ` lerdsuwa at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-08 10:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-12-08 10:56 -------
Fixed.

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


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


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

end of thread, other threads:[~2004-12-08 10:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 20:57 [Bug c++/18100] New: [3.4/4.0 regression] template member with same name as class not rejected reichelt at gcc dot gnu dot org
2004-10-21 21:02 ` [Bug c++/18100] " pinskia at gcc dot gnu dot org
2004-11-01  0:46 ` mmitchel at gcc dot gnu dot org
2004-11-16 10:05 ` reichelt at gcc dot gnu dot org
2004-11-16 20:35 ` reichelt at gcc dot gnu dot org
2004-11-16 21:08 ` reichelt at gcc dot gnu dot org
2004-12-04  7:34 ` lerdsuwa at gcc dot gnu dot org
2004-12-06 10:26 ` lerdsuwa at gcc dot gnu dot org
2004-12-07 12:35 ` lerdsuwa at gcc dot gnu dot org
2004-12-08  5:48 ` mark at codesourcery dot com
2004-12-08  9:05 ` nathan at codesourcery dot com
2004-12-08 10:13 ` lerdsuwa at gcc dot gnu dot org
2004-12-08 10:25 ` cvs-commit at gcc dot gnu dot org
2004-12-08 10:54 ` cvs-commit at gcc dot gnu dot org
2004-12-08 10:56 ` lerdsuwa at gcc dot gnu dot 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).