[Bug c++/69390] New: dynamic_cast on rvalue fails

columbo@gmx-topmail.de gcc-bugzilla@gcc.gnu.org
Wed Jan 20 14:09:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69390

            Bug ID: 69390
           Summary: dynamic_cast on rvalue fails
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: columbo@gmx-topmail.de
  Target Milestone: ---

The following code spuriously fails, because a "conversion to non-const
reference type 'struct main()::A&' from rvalue of type 'main()::A'" is
necessitated:

-----

int main(){
    struct A { virtual ~A() {}; };
    struct B : A {} b;
    dynamic_cast<B&&>(static_cast<A&&>(b));
}


More information about the Gcc-bugs mailing list