Topic: Member declaration references with no sub-object relation


Author: "Johannes Schaub (litb)" <schaub-johannes@web.de>
Date: Fri, 23 Oct 2009 10:34:47 CST
Raw View
What is the current (c++0x drafting) state of affairs for the following two
declarations? As far as i can see, they are valid?

struct A { int a; };
struct B : A {};
struct C : A {};
struct D : B, C { };
decltype(D::a) e; // #1
int f = sizeof(D::a); // #2

I tested this on GCC4.5/4.4 and EDG (comeau online compiler) with C++0x
enabled. Both reject it because the member reference is ambiguous with
regard to their sub-object relation. But name lookup itself is unambiguous
according to the draft n2960.

Is it already stated somewhere that this is ill-formed, is it an overview
and it should be ill-formed or is it really supposed to be valid?

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]