GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 38764 - bogus 'changes meaning' error?
Summary: bogus 'changes meaning' error?
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-08 12:22 UTC by Pawel Sikora
Modified: 2009-01-09 19:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2009-01-08 12:22:19 UTC
following code snipet is reducted testcase from external application.
g++ and comeau online accept/reject source differently.

template < class T >
struct A
{
};
template < class U >
struct B
{
#if 1
        typedef A< float > A; // <-- accepted by comeau but...
        // g++: error: declaration of typedef struct A<float> B<U>::A
        // g++: error: changes meaning of A from struct A<float>
#else
        typedef ::A< float > A; // <-- accepted by g++ but...
        // comeau: class member typedef may not be redeclared
        //         typedef ::A< float > A;
        //                              ^
#endif
};
Comment 1 Richard Biener 2009-01-08 12:50:05 UTC
I suggest filing a problem report with Comeau.  EDG accepts both in -strict_ansi mode.
Comment 2 Pawel Sikora 2009-01-08 12:56:05 UTC
(In reply to comment #1)
> I suggest filing a problem report with Comeau.  EDG accepts both in
> -strict_ansi mode.
> 

i've tested it on comeau online to verify g++ behaviour :)
Comment 3 pinskia@gmail.com 2009-01-08 19:16:12 UTC
Subject: Re:   New: bogus 'changes meaning' error?


On Jan 8, 2009, at 4:22 AM, "pluto at agmk dot net" <gcc-bugzilla@gcc.gnu.org 
 > wrote:

> following code snipet is reducted testcase from external application.
> g++ and comeau online accept/reject source differently.
>
> template < class T >
> struct A
> {
> };
> template < class U >
> struct B
> {
> #if 1
>        typedef A< float > A; // <-- accepted by comeau but...
>        // g++: error: declaration of typedef struct A<float> B<U>::A
>        // g++: error: changes meaning of A from struct A<float>
> #else
>        typedef ::A< float > A; // <-- accepted by g++ but...
>        // comeau: class member typedef may not be redeclared
>        //         typedef ::A< float > A;
>        //                              ^
> #endif
> };

GCC is correct.  This code is invalid but the standard says for this  
case no diagnostic is required so both compilers are correct according  
to the standard. Just that edg could be enchened to error about this  
case.


>
>
>
> -- 
>           Summary: bogus 'changes meaning' error?
>           Product: gcc
>           Version: 4.3.3
>            Status: UNCONFIRMED
>          Severity: normal
>          Priority: P3
>         Component: c++
>        AssignedTo: unassigned at gcc dot gnu dot org
>        ReportedBy: pluto at agmk dot net
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38764
>
Comment 4 Pawel Sikora 2009-01-09 19:39:32 UTC
as mentioned, gcc is correct.