Lines Matching defs:constexpr

11 constexpr int i1 = 0;
12 constexpr int f1() { return 0; }
14 constexpr static int mi1 = 0;
17 constexpr int s1::mi2 = 0;
21 constexpr extern int i2; // expected-error {{constexpr variable declaration must be a definition}}
23 constexpr notlit nl1; // expected-error {{constexpr variable cannot have non-literal type 'const notlit'}}
25 void f2(constexpr int i) {} // expected-error {{function parameter cannot be constexpr}}
28 constexpr int mi1; // expected-error {{non-static data member cannot be constexpr; did you intend to make it const?}}
29 static constexpr int mi2; // expected-error {{requires an initializer}}
30 mutable constexpr int mi3 = 3; // expected-error-re {{non-static data member cannot be constexpr{{$}}}} expected-error {{'mutable' and 'const' cannot be mixed}}
33 typedef constexpr int CI; // expected-error {{typedef cannot be constexpr}}
35 constexpr class C1 {}; // expected-error {{class cannot be marked constexpr}}
36 constexpr struct S1 {}; // expected-error {{struct cannot be marked constexpr}}
37 constexpr union U1 {}; // expected-error {{union cannot be marked constexpr}}
38 constexpr enum E1 {}; // expected-error {{enum cannot be marked constexpr}}
39 template <typename T> constexpr class TC1 {}; // expected-error {{class cannot be marked constexpr}}
40 template <typename T> constexpr struct TS1 {}; // expected-error {{struct cannot be marked constexpr}}
41 template <typename T> constexpr union TU1 {}; // expected-error {{union cannot be marked constexpr}}
42 class C2 {} constexpr; // expected-error {{class cannot be marked constexpr}}
43 struct S2 {} constexpr; // expected-error {{struct cannot be marked constexpr}}
44 union U2 {} constexpr; // expected-error {{union cannot be marked constexpr}}
45 enum E2 {} constexpr; // expected-error {{enum cannot be marked constexpr}}
46 constexpr class C3 {} c3 = C3();
47 constexpr struct S3 {} s3 = S3();
48 constexpr union U3 {} u3 = {};
49 constexpr enum E3 { V3 } e3 = V3;
50 class C4 {} constexpr c4 = C4();
51 struct S4 {} constexpr s4 = S4();
52 union U4 {} constexpr u4 = {};
53 enum E4 { V4 } constexpr e4 = V4;
54 constexpr int; // expected-error {{constexpr can only be used in variable and function declarations}}
56 constexpr int f3(); // expected-note {{previous declaration is here}}
57 int f3(); // expected-error {{non-constexpr declaration of 'f3' follows constexpr declaration}}
59 constexpr int f4(); // expected-error {{constexpr declaration of 'f4' follows non-constexpr declaration}}
60 template<typename T> constexpr T f5(T);
61 template<typename T> constexpr T f5(T); // expected-note {{previous}}
62 template<typename T> T f5(T); // expected-error {{non-constexpr declaration of 'f5' follows constexpr declaration}}
64 template<typename T> constexpr T f6(T); // expected-error {{constexpr declaration of 'f6' follows non-constexpr declaration}}
67 constexpr ~ConstexprDtor() = default; // expected-error {{destructor cannot be marked constexpr}}
71 template <typename T> constexpr T ft(T t) { return t; }
74 template<typename T> constexpr T f(); // expected-warning {{C++1y}}
82 template <> constexpr char ft(char nl); // expected-error {{constexpr declaration of 'ft<char>' follows non-constexpr declaration}}
83 template <> constexpr int gt(int nl) { return nl; }
85 template <> constexpr int S::g() { return 0; } // expected-note {{previous}} expected-warning {{C++1y}}
86 template <> int S::g() const; // expected-error {{non-constexpr declaration of 'g<int>' follows constexpr declaration}}
87 // specializations can drop the 'constexpr' but not the implied 'const'.
91 constexpr int i3 = ft(1);
94 // ignore constexpr when instantiating with non-literal
100 constexpr int square(int x); // expected-note {{declared here}}
101 constexpr int bufsz = 1024;
103 constexpr struct pixel { // expected-error {{struct cannot be marked constexpr}}
106 constexpr pixel(int);
109 constexpr pixel::pixel(int a)
113 constexpr pixel small(2); // expected-error {{must be initialized by a constant expression}} expected-note {{in call to 'pixel(2)'}}
115 constexpr int square(int x) {
119 constexpr pixel large(4);
121 int next(constexpr int x) { // expected-error {{function parameter cannot be constexpr}}
125 extern constexpr int memsz; // expected-error {{constexpr variable declaration must be a definition}}