c++ - Maybe my understanding of [class.access]/7 isn't correct, but -


from [class.access]/7 have following sentence:

similarly, use of a::b base-specifier well-formed because d derived a, checking of base-specifiers must deferred until entire base-specifier-list has been seen.

class { protected:     struct b { }; }; struct d: a::b, { }; 

see live example clang. matter of fact, clang complains snippet, no deferment necessary.

class { protected:     struct b { }; }; struct d: a, a::b { }; 

why code not compile?

ps: gcc , vs21013 don't compile codes either.

this compiler bug. normative text of standard supports example. fact multiple compilers have same bug means part of standard tricky right.

there open bugs for gcc , for clang. note few related cases subtle differences between c++03 , c++11, far can tell, not one.

[class.access]/1.2 merely states

protected; is, name can used members , friends of class in declared, classes derived class, , friends (see 11.4).

and 11.4 not expand on this. using name b in class d derived class a. that's fine.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -