[bug] typedefed base class not visible [VC8 RTM.050727-4200]



Hi people,

I'm testing

Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)

with our code base.

I'm getting lots of errors on code that compiled fine in 7.1.
Most of it boils down to the following new compiler bug:

struct A
{
int foo() const { return 1; }
};

struct B : A
{
typedef A base ;
};

struct D : B
{
} ;

int main(int argc, char* argv[])
{
B b ;
D d ;
int r0 = b.base::foo();
int r1 = d.base::foo(); // error C2039: 'A' : is not a member of 'D'

return 0;
}

As you can see, vc8 can't see the type B::base, which is A, from D.

Worst.. I get the same error even if D is defined as:

struct D : B
{
typedef B::base base ;
} ;

which explicitely redeclares B::base within D

I can of course do something like

struct D : B
{
typedef B Base ;
} ;

and then change the client code from

d.base::foo()

to

d.Base::base::foo()

which compiles OK, but I'd really hate to need to refactor ALL client code..
any ideas?

TIA


--
Fernando Cacciola
SciSoft
http://fcacciola.50webs.com/


.



Relevant Pages

  • Re: [PATCH 1/1] LinuxPPS: Pulse per Second support for Linux
    ... Follows my comments and then the patch, hope now I can came back into ... +typedef union pps_timeu { ... +typedef struct pps_info { ... different version of the compiler, and when different compiler options are ...
    (Linux-Kernel)
  • Re: Question about a struct declaration
    ... Well, then, can you come up with a different implementation hiding ... Client code doesn't see the implementation details of the concept ... typedef struct T_ T; ...
    (comp.lang.c)
  • Re: structs help
    ... >same name and the second compiler didn't like it. ... As I like to point out, the real problem with typedef is that it ... This is even more pronounced in the "typedef struct ..." ... time, though, I expect any programmer working on the zorgle program ...
    (comp.lang.c)
  • Re: C90 penetration
    ... If we agree on a set of digits that includes all Latin 1 alpha, ... if 'double' were indeed a typedef for a struct ... And there are a number of other reasons why making "double" a typedef ... for a struct type would make a compiler non-conforming. ...
    (comp.lang.c)
  • Re: [Q] superfluous ids in self-referential typedef struct
    ... >My compiler complains if I do something like this ... > typedef struct superfluous_identifier { ... Reading email is like searching for food in the garbage, ...
    (comp.lang.c)