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

schaub.johannes at googlemail dot com gcc-bugzilla@gcc.gnu.org
Thu Sep 29 06:58:00 GMT 2011


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

--- Comment #10 from Johannes Schaub <schaub.johannes at googlemail dot com> 2011-09-29 06:10:26 UTC ---
(In reply to comment #9)
> Excellent, then could you possibly comment on the implication for this PR? (for
> you it's easy, I'm sure)

Hi, wanna chime in here. It has no implication on my original PR (I'm not
taking a pointer to member), and has no implication on the example code Jason
quoted from the draft (so CWG983 was just noise -.-). Perhaps it's useful to
show more examples:

    struct A {
      int a;
    };

    struct B : A { };
    struct C : A { };
    struct D : B, C { };

    struct E : D { 
      // valid, refers to one declaration
      using D::a; 
    };

The above is valid in C++0x, and invalid in C++03. Certain uses of the alias
name E::a are valid, while others are invalid (those that check subobject
affinity)

    decltype(E::a) x; // valid
    int x = E().a; // invalid

See WMM's paper at
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1543.pdf and the
usenet discussion at
http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/4ae640b13b0bd334/
.



More information about the Gcc-bugs mailing list