[Bug c++/51161] New: [C++0x] Illegal static_cast to rvalue reference to ambiguous base class

ai.azuma at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 16 15:35:00 GMT 2011


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

             Bug #: 51161
           Summary: [C++0x] Illegal static_cast to rvalue reference to
                    ambiguous base class
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ai.azuma@gmail.com


Created attachment 25838
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25838
Outputs from -v option and preprocessed source.

According to N3291 (5.2.9/3), the following code is ill-formed. However, GCC
4.7-20111112 with -std=c++11 accepts it.


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

int main()
{
  D d;
  static_cast<A &&>(d);
}
///////////////////////



More information about the Gcc-bugs mailing list