p3-0x.cpp 528 B

1234567891011121314
  1. // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
  2. struct X { virtual ~X(); };
  3. struct Y : public X { };
  4. struct Z; // expected-note{{forward declaration of 'Z'}}
  5. void test(X &x, Y &y, Z &z) {
  6. // If T is an rvalue reference type, v shall be an expression having
  7. // a complete class type, and the result is an xvalue of the type
  8. // referred to by T.
  9. Y &&yr0 = dynamic_cast<Y&&>(x);
  10. Y &&yr1 = dynamic_cast<Y&&>(static_cast<X&&>(x));
  11. Y &&yr2 = dynamic_cast<Y&&>(z); // expected-error{{'Z' is an incomplete type}}
  12. }