clang/test/CXX/class/class.bit/p2.cpp
raw| 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
| 2 | |
| 3 | struct A { |
| 4 | private: |
| 5 | int : 0; |
| 6 | }; |
| 7 | |
| 8 | A a = { }; |
| 9 | A a2 = { 1 }; // expected-error{{excess elements in struct initializer}} |
| 10 | |
| 11 | struct B { |
| 12 | const int : 0; // expected-error{{anonymous bit-field cannot have qualifiers}} |
| 13 | }; |
| 14 | |
| 15 | B b; |
| 16 | |
| 17 | void testB() { |
| 18 | B b2(b); |
| 19 | B b3(static_cast<B&&>(b2)); |
| 20 | b = b; |
| 21 | b = static_cast<B&&>(b); |
| 22 | } |