[BUG]? "cannot access inaccessible typedef"

  • Thread starter Thread starter Thomas Barnet-Lamb
  • Start date Start date
T

Thomas Barnet-Lamb

I was wondering if anyone could give me some help with the following.
Consider the code snippet:

struct qqq{typedef qqq* pointer;};

template<class al> struct foo : public al
{
template <class T> struct rebind
{
typedef foo<qqq> other;
};
};

int main()
{
typedef foo<qqq >::rebind<qqq>::other alloc_typ;
typedef alloc_typ::rebind<qqq>::other::pointer pppp;
return 0;
}

Is there any reason that this code should not compile? MS VC .NET 2003
gives error message:

c:\Documents and Settings\tblamb\My Documents\Visual Studio
Projects\test0\test0\test0.cpp(20) : error C2248:
'foo<al>::rebind<T>::other' : cannot access inaccessible typedef
declared in class 'foo<al>'
with
[
al=qqq,
T=qqq
]
and
[
al=qqq
]
.... etc.

Unfortunately, I cannot see why the typedef ought to be inaccessible.
(Indeed, the error message itself is a little strange, since normally
the compiler gives messages like "cannot access private typedef" or
"cannot access protected typedef", which explain why the symbol is
inaccessible, rather than just "cannot access inaccessible typedef".)
The www.comeaucomputing.com compiler accepted the code. I have not
tested it with g++.

Thanks for any help!

Thomas Barnet-Lamb
Programmer, Lionhead Studios Ltd.
www.lionhead.com
 
Thomas,
Unfortunately, I cannot see why the typedef ought to be inaccessible.

I cannot either -- it definitely looks like a bug in the compiler. I'll
enter it to our database.
(Indeed, the error message itself is a little strange, since normally
the compiler gives messages like "cannot access private typedef" or
"cannot access protected typedef", which explain why the symbol is
inaccessible, rather than just "cannot access inaccessible typedef".)

I agree that "cannot access inacessible" sounds silly. We'll fix it.

Thanks for your feedback.

Artur Laksberg,
Visual C++ Compiler Development Team
This posting is provided AS IS with no warranties, and confers no rights.
 
Back
Top