xref: /minix3/external/bsd/llvm/dist/clang/test/CXX/class/class.bit/p2.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct A {
4*f4a2713aSLionel Sambuc private:
5*f4a2713aSLionel Sambuc   int : 0;
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc A a = { };
9*f4a2713aSLionel Sambuc A a2 = { 1 }; // expected-error{{excess elements in struct initializer}}
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc struct B {
12*f4a2713aSLionel Sambuc   const int : 0;
13*f4a2713aSLionel Sambuc };
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc B b;
16*f4a2713aSLionel Sambuc 
testB()17*f4a2713aSLionel Sambuc void testB() {
18*f4a2713aSLionel Sambuc   B b2(b);
19*f4a2713aSLionel Sambuc   B b3(static_cast<B&&>(b2));
20*f4a2713aSLionel Sambuc   b = b;
21*f4a2713aSLionel Sambuc   b = static_cast<B&&>(b);
22*f4a2713aSLionel Sambuc }
23