471,109 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,109 software developers and data experts.

[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 2901
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.