Date: Wed, 20 Sep 2023 22:50:30 +0300
In the section "11.9 Member access control" of the C++20 Standard there is provided an example (p.#7, example #2) of using a protected inner class of a class as a base class for a derived class and the corresponding text relative to such a declaration.
Here is a simplified by me version of the example
class A {
//...
protected:
struct B { };
};
struct D: A::B, A { };
And there is written
>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.
However this declaration
struct D: A::B, A { };
is compiled by neither for example x86-64 clang (trunk) nor by MS VS C++ w i th i ts last vers ion of the compiler.
if to change the declaration li k e
struct D : A, A::B { };
then the MS VS C++ comp iler compiles the declaration. However the compiler x86-64 clang (trunk) still does not compile the declaration.
is it a bug of the compilers?
With best regards,
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
Here is a simplified by me version of the example
class A {
//...
protected:
struct B { };
};
struct D: A::B, A { };
And there is written
>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.
However this declaration
struct D: A::B, A { };
is compiled by neither for example x86-64 clang (trunk) nor by MS VS C++ w i th i ts last vers ion of the compiler.
if to change the declaration li k e
struct D : A, A::B { };
then the MS VS C++ comp iler compiles the declaration. However the compiler x86-64 clang (trunk) still does not compile the declaration.
is it a bug of the compilers?
With best regards,
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
Received on 2023-09-20 19:50:41