public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33677]  New: Member with same name as class
@ 2007-10-06 13:40 s__nakayama at infoseek dot jp
  2007-10-09 22:22 ` [Bug c++/33677] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: s__nakayama at infoseek dot jp @ 2007-10-06 13:40 UTC (permalink / raw)
  To: gcc-bugs

GCC accept test1.cc. But GCC reject test2.cc.
IMHO, this code is valid. 

test1.cc:
struct foo
{
  ~foo(){}
  int foo;
};

test2.cc:
struct foo
{
  int foo;
  ~foo(){}
};


-- 
           Summary: Member with same name as class
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: s__nakayama at infoseek dot jp


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


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

* [Bug c++/33677] Member with same name as class
  2007-10-06 13:40 [Bug c++/33677] New: Member with same name as class s__nakayama at infoseek dot jp
@ 2007-10-09 22:22 ` pinskia at gcc dot gnu dot org
  2007-10-11 13:50 ` s__nakayama at infoseek dot jp
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-10-09 22:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-10-09 22:22 -------
This code is invalid, and we should reject both of them.


-- 


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


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

* [Bug c++/33677] Member with same name as class
  2007-10-06 13:40 [Bug c++/33677] New: Member with same name as class s__nakayama at infoseek dot jp
  2007-10-09 22:22 ` [Bug c++/33677] " pinskia at gcc dot gnu dot org
@ 2007-10-11 13:50 ` s__nakayama at infoseek dot jp
  2009-01-01  4:12 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: s__nakayama at infoseek dot jp @ 2007-10-11 13:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from s__nakayama at infoseek dot jp  2007-10-11 13:50 -------
(In reply to comment #1)
> This code is invalid, and we should reject both of them.

Why do you think that this is invalid?
Member with same name as class have restrictions(ISO/IEC 14882:2003 9.2
p13/13a).
But, I can not find the restriction that this is invalid.


-- 


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


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

* [Bug c++/33677] Member with same name as class
  2007-10-06 13:40 [Bug c++/33677] New: Member with same name as class s__nakayama at infoseek dot jp
  2007-10-09 22:22 ` [Bug c++/33677] " pinskia at gcc dot gnu dot org
  2007-10-11 13:50 ` s__nakayama at infoseek dot jp
@ 2009-01-01  4:12 ` pinskia at gcc dot gnu dot org
  2009-01-01  4:19 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-01  4:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-01-01 04:10 -------
Because it changes the meaning of foo inside the struct.


-- 


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


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

* [Bug c++/33677] Member with same name as class
  2007-10-06 13:40 [Bug c++/33677] New: Member with same name as class s__nakayama at infoseek dot jp
                   ` (2 preceding siblings ...)
  2009-01-01  4:12 ` pinskia at gcc dot gnu dot org
@ 2009-01-01  4:19 ` pinskia at gcc dot gnu dot org
  2009-01-01  4:22 ` [Bug c++/33677] Member with same name as class is not rejected pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-01  4:19 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 400 bytes --]



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-01-01 04:18 -------
If T is the name of a class, then each of the following shall have a name
different from T:
— every data member of class T;

The way I read is that foo cannot be the name of the data member of class foo.

Hmm, maybe there was a defect report about this ...


-- 


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


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

* [Bug c++/33677] Member with same name as class is not rejected
  2007-10-06 13:40 [Bug c++/33677] New: Member with same name as class s__nakayama at infoseek dot jp
                   ` (3 preceding siblings ...)
  2009-01-01  4:19 ` pinskia at gcc dot gnu dot org
@ 2009-01-01  4:22 ` pinskia at gcc dot gnu dot org
  2009-01-02 14:53 ` s__nakayama at infoseek dot jp
  2009-01-02 19:04 ` [Bug c++/33677] [DR 80] Member with same name as class is rejected pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-01  4:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2009-01-01 04:20 -------
So confirmed as being invalid code at least the way I read the standard.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |accepts-invalid
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-01 04:20:39
               date|                            |
            Summary|Member with same name as    |Member with same name as
                   |class                       |class is not rejected


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


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

* [Bug c++/33677] Member with same name as class is not rejected
  2007-10-06 13:40 [Bug c++/33677] New: Member with same name as class s__nakayama at infoseek dot jp
                   ` (4 preceding siblings ...)
  2009-01-01  4:22 ` [Bug c++/33677] Member with same name as class is not rejected pinskia at gcc dot gnu dot org
@ 2009-01-02 14:53 ` s__nakayama at infoseek dot jp
  2009-01-02 19:04 ` [Bug c++/33677] [DR 80] Member with same name as class is rejected pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: s__nakayama at infoseek dot jp @ 2009-01-02 14:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from s__nakayama at infoseek dot jp  2009-01-02 14:52 -------
> If T is the name of a class, then each of the following shall have a name 
> different from T:
> - every data member of class T;

This description is the one in "ISO/IEC 14882:1998". 
It was changed in "ISO/IEC 14882:2003" as follows.

> If T is the name of a class, then each of the following shall have a name 
> different from T:
> - every static data member of class T;

http://www.open-std.org/jtc1/sc22/wg21/docs/core5.htm#80


-- 


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


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

* [Bug c++/33677] [DR 80] Member with same name as class is rejected
  2007-10-06 13:40 [Bug c++/33677] New: Member with same name as class s__nakayama at infoseek dot jp
                   ` (5 preceding siblings ...)
  2009-01-02 14:53 ` s__nakayama at infoseek dot jp
@ 2009-01-02 19:04 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-02 19:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2009-01-02 19:02 -------
Oh, I see now, The current version of the defect reports can be found at 

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html DR80.

I tried looking for it but I must have missed it.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|accepts-invalid             |rejects-valid
            Summary|Member with same name as    |[DR 80] Member with same
                   |class is not rejected       |name as class is rejected


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


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

end of thread, other threads:[~2009-01-02 19:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-06 13:40 [Bug c++/33677] New: Member with same name as class s__nakayama at infoseek dot jp
2007-10-09 22:22 ` [Bug c++/33677] " pinskia at gcc dot gnu dot org
2007-10-11 13:50 ` s__nakayama at infoseek dot jp
2009-01-01  4:12 ` pinskia at gcc dot gnu dot org
2009-01-01  4:19 ` pinskia at gcc dot gnu dot org
2009-01-01  4:22 ` [Bug c++/33677] Member with same name as class is not rejected pinskia at gcc dot gnu dot org
2009-01-02 14:53 ` s__nakayama at infoseek dot jp
2009-01-02 19:04 ` [Bug c++/33677] [DR 80] Member with same name as class is rejected pinskia 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).