468,720 Members | 1,602 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

[BUG]? "cannot access inaccessible typedef"

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
Nov 16 '05 #1
1 2762
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.

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Fao | last post: by
6 posts views Thread by hercules | last post: by
134 posts views Thread by jacob navia | last post: by
2 posts views Thread by Rajat Tandon | last post: by
8 posts views Thread by Mohammad Omer Nasir | last post: by
8 posts views Thread by cman | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Oskars | last post: by
9 posts views Thread by bryonone | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.