public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13902] New: Misleading diagnostic for static data member definition
@ 2004-01-28 21:48 gdr at gcc dot gnu dot org
  2004-01-28 21:49 ` [Bug c++/13902] " gdr at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-01-28 21:48 UTC (permalink / raw)
  To: gcc-bugs

Compile the attached file and look at the message
for line 5.  It is speaking of 'sizeof (*T)' which definitely
is wrong.  I've not checked with 3.4.x or mainline but I 
suspect the problem would be there too.

Oh, whether the program is well-formed or not is a different
issue (I think it is, but that needs a formal proof).

-- 
           Summary: Misleading diagnostic for static data member definition
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gdr at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/13902] Misleading diagnostic for static data member definition
  2004-01-28 21:48 [Bug c++/13902] New: Misleading diagnostic for static data member definition gdr at gcc dot gnu dot org
@ 2004-01-28 21:49 ` gdr at gcc dot gnu dot org
  2004-01-28 21:55 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-01-28 21:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-01-28 21:49 -------
Created an attachment (id=5603)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5603&action=view)
Bah


-- 


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


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

* [Bug c++/13902] Misleading diagnostic for static data member definition
  2004-01-28 21:48 [Bug c++/13902] New: Misleading diagnostic for static data member definition gdr at gcc dot gnu dot org
  2004-01-28 21:49 ` [Bug c++/13902] " gdr at gcc dot gnu dot org
@ 2004-01-28 21:55 ` pinskia at gcc dot gnu dot org
  2004-01-28 22:04 ` gdr at integrable-solutions dot net
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-28 21:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-28 21:54 -------
The mainline gives:
pr13902.cc:5: error: `T' was not declared in this scope
pr13902.cc:9: error: conflicting declaration 'char X< <template-parameter-1-1> >::buf[(sizeof (T) 
* X< <template-parameter-1-1> >::S)]'
pr13902.cc:5: error: 'X< <template-parameter-1-1> >::buf' has a previous declaration as `char 
X< <template-parameter-1-1> >::buf[(<expression error> * X< <template-parameter-1-1> >::
S)]'
pr13902.cc:9: error: template definition of non-template `char X< <template-parameter-1-1> >::
buf[(sizeof (T) * X< <template-parameter-1-1> >::S)]'

While 2.95.3 to 3.3.3 gives about the same
from 2.95.3:
pr13902.cc:9: conflicting types for `char X<{anonymous template type parm}>::buf[(sizeof (T) * 
X<{anonymous template type parm}>::S)]'
pr13902.cc:5: previous declaration as `char X<{anonymous template type parm}>::buf[(sizeof 
((*T)) * X<{anonymous template type parm}>::S)]'
>From 3.3:
pr13902.cc:9: error: conflicting types for `char X<<anonymous template type 
   parameter> >::buf[(sizeof (T) * X<<anonymous template type parameter> >::S)]
   '
pr13902.cc:5: error: previous declaration as `char X<<anonymous template type 
   parameter> >::buf[(sizeof ((*T)) * X<<anonymous template type parameter> 
   >::S)]'

I do not know if you would count this as fixed though, I am leaving it up to you, Gaby or someone 
else.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic


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


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

* [Bug c++/13902] Misleading diagnostic for static data member definition
  2004-01-28 21:48 [Bug c++/13902] New: Misleading diagnostic for static data member definition gdr at gcc dot gnu dot org
  2004-01-28 21:49 ` [Bug c++/13902] " gdr at gcc dot gnu dot org
  2004-01-28 21:55 ` pinskia at gcc dot gnu dot org
@ 2004-01-28 22:04 ` gdr at integrable-solutions dot net
  2004-01-28 22:13 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-01-28 22:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-01-28 22:04 -------
Subject: Re:  Misleading diagnostic for static data member definition

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| The mainline gives:
| pr13902.cc:5: error: `T' was not declared in this scope
| pr13902.cc:9: error: conflicting declaration 'char X< <template-parameter-1-1> >::buf[(sizeof (T) 
| * X< <template-parameter-1-1> >::S)]'
| pr13902.cc:5: error: 'X< <template-parameter-1-1> >::buf' has a previous declaration as `char 
| X< <template-parameter-1-1> >::buf[(<expression error> * X< <template-parameter-1-1> >::
| S)]'

[...]

| I do not know if you would count this as fixed though, I am leaving
| it up to you, Gaby or someone  else.

Thanks for the quick testing. I made an error: the template parameter
should not be missing.  E.g. the testcase should have been

     template<class T>
     struct X {
        enum { S = 8};

        static char buf[sizeof (T) * S];
     };

     template<class T>
     char X<T>::buf[sizeof (T) * X<T>::S];

With this corrected version, the code is still rejected.

Sorry for the confusion.

-- Gaby


-- 


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


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

* [Bug c++/13902] Misleading diagnostic for static data member definition
  2004-01-28 21:48 [Bug c++/13902] New: Misleading diagnostic for static data member definition gdr at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-01-28 22:04 ` gdr at integrable-solutions dot net
@ 2004-01-28 22:13 ` pinskia at gcc dot gnu dot org
  2004-01-28 22:17 ` gdr at integrable-solutions dot net
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-28 22:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-28 22:13 -------
On the mainline this is accepted, I have not looked to see which is correct though.

-- 


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


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

* [Bug c++/13902] Misleading diagnostic for static data member definition
  2004-01-28 21:48 [Bug c++/13902] New: Misleading diagnostic for static data member definition gdr at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-01-28 22:13 ` pinskia at gcc dot gnu dot org
@ 2004-01-28 22:17 ` gdr at integrable-solutions dot net
  2004-01-28 22:22 ` pinskia at gcc dot gnu dot org
  2004-01-28 23:25 ` gdr at integrable-solutions dot net
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-01-28 22:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-01-28 22:17 -------
Subject: Re:  Misleading diagnostic for static data member definition

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| On the mainline this is accepted, I have not looked to see which is
| correct though. 

The code is  well-formed. So are you saying that 3.3 and 3.4 reject
it while mainline accepts?

-- Gaby


-- 


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


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

* [Bug c++/13902] Misleading diagnostic for static data member definition
  2004-01-28 21:48 [Bug c++/13902] New: Misleading diagnostic for static data member definition gdr at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-01-28 22:17 ` gdr at integrable-solutions dot net
@ 2004-01-28 22:22 ` pinskia at gcc dot gnu dot org
  2004-01-28 23:25 ` gdr at integrable-solutions dot net
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-28 22:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-28 22:22 -------
I just checked 3.4.0 also and it is accepted, the change happened when the new parser went in.  So 
if I understand this correctly this is fixed for 3.4.0, right?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/13902] Misleading diagnostic for static data member definition
  2004-01-28 21:48 [Bug c++/13902] New: Misleading diagnostic for static data member definition gdr at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-01-28 22:22 ` pinskia at gcc dot gnu dot org
@ 2004-01-28 23:25 ` gdr at integrable-solutions dot net
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-01-28 23:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-01-28 23:25 -------
Subject: Re:  Misleading diagnostic for static data member definition

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| I just checked 3.4.0 also and it is accepted, the change happened
| when the new parser went in.  So if I understand this correctly this
| is fixed for 3.4.0, right? 

Yes. Thanks a lot for your detective work.
I agree with your resolution.

-- Gaby


-- 


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


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

end of thread, other threads:[~2004-01-28 23:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-28 21:48 [Bug c++/13902] New: Misleading diagnostic for static data member definition gdr at gcc dot gnu dot org
2004-01-28 21:49 ` [Bug c++/13902] " gdr at gcc dot gnu dot org
2004-01-28 21:55 ` pinskia at gcc dot gnu dot org
2004-01-28 22:04 ` gdr at integrable-solutions dot net
2004-01-28 22:13 ` pinskia at gcc dot gnu dot org
2004-01-28 22:17 ` gdr at integrable-solutions dot net
2004-01-28 22:22 ` pinskia at gcc dot gnu dot org
2004-01-28 23:25 ` gdr at integrable-solutions dot net

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