[Bug c++/41796] ambiguous subobject diagnostic given too early

schaub-johannes at web dot de gcc-bugzilla@gcc.gnu.org
Thu Feb 11 01:08:00 GMT 2010



------- Comment #3 from schaub-johannes at web dot de  2010-02-11 01:08 -------
Well this is certainly not valid C++03, so i have tagged it c++0x (class member
name lookup was completely rewritten in c++0x, which made it valid and which
also added 10.2). In '03, the following should fail i think, instead of
re-declaring the member name as an alias to the declaration of "a" in A:

struct A { int a; }; 
struct B : A {}; 
struct C : A {}; 
struct D : B, C { }; 
struct E : D { using D::a; };

The example in 10.2/13 (n3000) is missing an ambiguity check: It's impossible
for GCC to figure out to which sub-object the member pointer address is
associated with. I think the example is wrong (see
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#983 for the issue
report about it).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41796



More information about the Gcc-bugs mailing list