p2.cpp 309 B

12345678910111213141516171819202122
  1. // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
  2. struct A {
  3. private:
  4. int : 0;
  5. };
  6. A a = { };
  7. A a2 = { 1 }; // expected-error{{excess elements in struct initializer}}
  8. struct B {
  9. const int : 0;
  10. };
  11. B b;
  12. void testB() {
  13. B b2(b);
  14. B b3(static_cast<B&&>(b2));
  15. b = b;
  16. b = static_cast<B&&>(b);
  17. }