Home | History | Annotate | Download | only in dcl.constexpr

Lines Matching full:constexpr

12 struct NonLiteral { // expected-note 2{{no constexpr constructors}}
17 constexpr Literal() {}
22 // In the definition of a constexpr constructor, each of the parameter types
25 constexpr S(int, N::C) {}
26 constexpr S(int, NonLiteral, N::C) {} // expected-error {{constexpr constructor's 2nd parameter type 'NonLiteral' is not a literal type}}
27 constexpr S(int, NonLiteral = 42) {} // expected-error {{constexpr constructor's 2nd parameter type 'NonLiteral' is not a literal type}}
30 constexpr S() = default;
31 constexpr S(Literal) = delete;
38 constexpr T() {} // expected-error {{constexpr constructor not allowed in struct with virtual base class}}
45 constexpr C() {} // expected-error {{constexpr constructor not allowed in class with virtual base class}}
51 constexpr U()
52 try // expected-error {{function try block not allowed in constexpr constructor}}
62 constexpr V() {
85 constexpr V(int(&)[1]) {
89 // expected-error@-3 {{statement not allowed in constexpr constructor}}
92 constexpr V(int(&)[2]) {
93 constexpr int a = 0;
95 // expected-error@-2 {{variable declaration in a constexpr constructor is a C++1y extension}}
98 constexpr V(int(&)[3]) {
99 constexpr int ForwardDecl(int);
101 // expected-error@-2 {{use of this statement in a constexpr constructor is a C++1y extension}}
104 constexpr V(int(&)[4]) {
107 // expected-error@-2 {{type definition in a constexpr constructor is a C++1y extension}}
110 constexpr V(int(&)[5]) {
113 // expected-error@-2 {{type definition in a constexpr constructor is a C++1y extension}}
116 constexpr V(int(&)[6]) {
119 // expected-error@-2 {{type definition in a constexpr constructor is a C++1y extension}}
122 constexpr V(int(&)[7]) {
125 // expected-error@-2 {{use of this statement in a constexpr constructor is a C++1y extension}}
133 constexpr W() {} // expected-error {{constexpr constructor must initialize all members}}
160 constexpr AnonMembers(int(&)[1]) : a(), b(), g(), h(), i(), j() {} // ok
162 constexpr AnonMembers(int(&)[2]) : a(), c(), g(), h() {} // expected-error {{constexpr constructor must initialize all members}}
163 constexpr AnonMembers(int(&)[3]) : a(), e(), g(), h(), i(), k() {} // ok
165 constexpr AnonMembers(int(&)[4]) : a(), c(), d(), g(), i() {} // expected-error {{constexpr constructor must initialize all members}}
167 constexpr AnonMembers(int(&)[5]) : a(), g(), h(), i(), k() {} // expected-error {{constexpr constructor must initialize all members}}
169 constexpr AnonMembers(int(&)[6]) {} // expected-error {{constexpr constructor must initialize all members}}
173 constexpr Empty() {} // ok
174 } constexpr empty1;
179 constexpr EmptyVariant() {} // ok
180 } constexpr empty2;
203 constexpr TemplateInit() {} // desired-error {{must initialize all members}}
207 constexpr TemplateInit2() {} // ok
211 constexpr weak_ptr() : p(0) {}
216 constexpr enable_shared_from_this() {} // ok
218 constexpr int f(enable_shared_from_this<int>);
221 // class sub-objects shall be a constexpr constructor.
225 constexpr ConstexprBaseMemberCtors() : Literal(), l() {} // ok
226 constexpr ConstexprBaseMemberCtors(char) : // expected-error {{constexpr constructor never produces a constant expression}}
227 Literal(0), // expected-note {{non-constexpr constructor}}
229 constexpr ConstexprBaseMemberCtors(double) : Literal(), // expected-error {{constexpr constructor never produces a constant expression}}
230 l(0) // expected-note {{non-constexpr constructor}}
245 constexpr X() {}
246 constexpr X(int c) : a(c) {} // ok, b initialized by 2 * c + 1
249 union XU1 { int a; constexpr XU1() = default; }; // expected-error{{not constexpr}}
250 union XU2 { int a = 1; constexpr XU2() = default; };
256 constexpr XU3() = default; // expected-error{{not constexpr}}
262 constexpr XU4() = default;
278 constexpr Z(int a) : n(a) {}
279 constexpr Z() : n(kGlobal) {} // expected-error {{constexpr constructor never produces a constant expression}} expected-note {{read of non-const}}
286 explicit constexpr Length(int i = 0) : val(i) { }
295 constexpr A(const A&) {}
297 constexpr A(int = 0);
302 constexpr B(const B&);
303 constexpr B(B&);
305 constexpr B::B(const B&) = default;
306 constexpr B::B(B&) = default; // expected-error {{not constexpr}}
311 constexpr C(const C&);
312 constexpr C(C&);
314 constexpr C::C(const C&) = default;
315 constexpr C::C(C&) = default; // expected-error {{not constexpr}}
327 constexpr V() : x(0) {}
330 // The constructor is still 'constexpr' here, but the result is not intended
333 constexpr V<int> v; // expected-error {{constant expression}} expected-note {{subobject of type 'int' is not initialized}}
335 constexpr int k = V<int>().x; // FIXME: ok?