This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++] Possible GCC bug


On Wed, Nov 14, 2012 at 6:10 PM, Piotr Wyderski
<piotr.wyderski@gmail.com> wrote:
> The following snippet:
>
> class A {};
> class B : public A {
>
>    typedef A super;
>
> public:
>
>    class X {};
> };
>
>
> class C : public B {
>
>    typedef B super;
>
>    class X : public super::X {
>
>       typedef super::X super;
>    };
> };
>
> compiles without a warning on Comeau and MSVC, but GCC (4.6.1 and
> 4.7.1) failes with the following message:
>
> $ gcc -c bug.cpp
> bug.cpp:18:24: error: declaration of ‘typedef class B::X C::X::super’
> [-fpermissive]
> bug.cpp:14:14: error: changes meaning of ‘super’ from ‘typedef class B
> C::super’ [-fpermissive]
>
> Should I file a report?
>
>     Best regards, Piotr

Here's a two-line TC:

typedef struct { typedef int type; } s1;
struct S2 { s1::type s1; };

Fails with GCC 4.6.3; succeeds with clang 3.0. Looks like a bug to me.

/Ulf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]