An access issue -- programming on auto-pilot...

A

Alf P. Steinbach

Since others' errors can be enlightening, here's one of mine.

Without really thinking, apparently on complete auto-pilot, I'd written code
equivalent to

class Base
{
protected:
class Interface {};
};

class Derived
: public Base
, protected Base::Interface
{
};

int main()
{
}

This actually compiles with MSVC 7.1! :-(


Cheers & hth.,

- Alf
 
F

Fraser Ross

"Alf P. Steinbach"
Since others' errors can be enlightening, here's one of mine.

Without really thinking, apparently on complete auto-pilot, I'd
written code equivalent to

class Base
{
protected:
class Interface {};
};

class Derived
: public Base
, protected Base::Interface
{
};

int main()
{
}

This actually compiles with MSVC 7.1! :-(


Cheers & hth.,

- Alf

It should compile. Comeau has a bug. Did you compare it to Comeau?
Look at clause 11/6 and 7. The example is almost the same. It says
"Similarly, the use of A::B
as a base-specifier is well-formed because D is derived from A, so
checking of base-specifiers must be deferred until the entire
base-specifier-list has been seen.".


Fraser.
 
A

Alf P. Steinbach

* Fraser Ross:
"Alf P. Steinbach"

It should compile. Comeau has a bug. Did you compare it to Comeau?

Yes.


Comeau C/C++ 4.3.10.1 (Oct 6 2008 11:28:09) for ONLINE_EVALUATION_BETA2
Copyright 1988-2008 Comeau Computing. All rights reserved.
MODE:strict errors C++ C++0x_extensions

"ComeauTest.c", line 10: error: class "Base::Interface" (declared at line 5) is
inaccessible
, protected Base::Interface
^

1 error detected in the compilation of "ComeauTest.c".



Look at clause 11/6 and 7. The example is almost the same. It says
"Similarly, the use of A::B
as a base-specifier is well-formed because D is derived from A, so
checking of base-specifiers must be deferred until the entire
base-specifier-list has been seen.".

Heh, I'm better on auto-pilot than the darned compilers! ;-)

Thanks, I thought it was the code that was incorrect.


Cheers,

- Alf
 
F

Fraser Ross

Comeau follows the 2003 standard and thats why it reports an error. I
was looking at the latest draft.

Fraser.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top