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

Lines Matching refs:constexpr

12 struct NonLiteral { // expected-note 3{{no constexpr constructors}}
17 constexpr Literal() {}
28 // The definition of a constexpr function shall satisfy the following
31 constexpr T();
32 constexpr int f() const; // expected-error {{non-literal type 'T' cannot have constexpr members}}
35 virtual constexpr int ExplicitlyVirtual() const { return 0; } // expected-error {{virtual function cannot be constexpr}}
37 constexpr int ImplicitlyVirtual() const { return 0; } // expected-error {{virtual function cannot be constexpr}}
40 constexpr NonLiteral NonLiteralReturn() const { return {}; } // expected-error {{constexpr function's return type 'NonLiteral' is not a literal type}}
41 constexpr void VoidReturn() const { return; }
43 // expected-error@-2 {{constexpr function's return type 'void' is not a literal type}}
45 constexpr ~T(); // expected-error {{destructor cannot be marked constexpr}}
47 constexpr F NonLiteralReturn2; // ok until definition
50 constexpr int NonLiteralParam(NonLiteral) const { return 0; } // expected-error {{constexpr function's 1st parameter type 'NonLiteral' is not a literal type}}
52 constexpr G NonLiteralParam2; // ok until definition
55 constexpr int Deleted() const = delete;
59 // destructor can be defaulted. Destructors can't be constexpr since they
61 // constexpr since they can't be const.
62 constexpr T &operator=(const T&) = default;
64 // expected-error@-2 {{an explicitly-defaulted copy assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}}
67 // expected-error@-5 {{defaulted definition of copy assignment operator is not constexpr}}
73 constexpr T2 &operator=(const T2&) = default; // ok
76 constexpr T3 &operator=(const T3&) const = default;
81 constexpr U SelfReturn() const;
82 constexpr int SelfParam(U) const;
86 constexpr int F() const { return 0; } // expected-error {{constexpr member function not allowed in struct with virtual base class}}
90 constexpr int AllowedStmtsCXX11() {
117 constexpr int DisallowedStmtsCXX1Y_1() {
119 asm("int3"); // expected-error {{statement not allowed in constexpr function}}
122 constexpr int DisallowedStmtsCXX1Y_2() {
124 goto x; // expected-error {{statement not allowed in constexpr function}}
128 constexpr int DisallowedStmtsCXX1Y_3() {
130 try {} catch (...) {} // expected-error {{statement not allowed in constexpr function}}
133 constexpr int DisallowedStmtsCXX1Y_4() {
135 NonLiteral nl; // expected-error {{variable of non-literal type 'NonLiteral' cannot be defined in a constexpr function}}
138 constexpr int DisallowedStmtsCXX1Y_5() {
140 static constexpr int n = 123; // expected-error {{static variable not permitted in a constexpr function}}
143 constexpr int DisallowedStmtsCXX1Y_6() {
145 thread_local constexpr int n = 123; // expected-error {{thread_local variable not permitted in a constexpr function}}
148 constexpr int DisallowedStmtsCXX1Y_7() {
150 int n; // expected-error {{variables defined in a constexpr function must be initialized}}
154 constexpr int ForStmt() {
157 // expected-error@-2 {{statement not allowed in constexpr function}}
161 constexpr int VarDecl() {
164 // expected-error@-2 {{variable declaration in a constexpr function is a C++1y extension}}
168 constexpr int ConstexprVarDecl() {
169 constexpr int a = 0;
171 // expected-error@-2 {{variable declaration in a constexpr function is a C++1y extension}}
175 constexpr int VarWithCtorDecl() {
178 // expected-error@-2 {{variable declaration in a constexpr function is a C++1y extension}}
183 constexpr NonLiteral &ExternNonLiteralVarDecl() {
186 // expected-error@-2 {{variable declaration in a constexpr function is a C++1y extension}}
191 constexpr int FuncDecl() {
192 constexpr int ForwardDecl(int);
194 // expected-error@-2 {{use of this statement in a constexpr function is a C++1y extension}}
198 constexpr int ClassDecl1() {
201 // expected-error@-2 {{type definition in a constexpr function is a C++1y extension}}
205 constexpr int ClassDecl2() {
208 // expected-error@-2 {{type definition in a constexpr function is a C++1y extension}}
212 constexpr int ClassDecl3() {
215 // expected-error@-2 {{type definition in a constexpr function is a C++1y extension}}
219 constexpr int NoReturn() {} // expected-error {{no return statement in constexpr function}}
220 constexpr int MultiReturn() {
224 // expected-error@-2 {{multiple return statements in constexpr function}}
234 // a constexpr function must be able to produce a constant expression.
236 constexpr int f(int k) {
241 constexpr int f() { // expected-error {{constexpr function never produces a constant expression}}
263 constexpr int square(int x) {
266 constexpr long long_max() {
269 constexpr int abs(int x) {
277 constexpr int first(int n) {
281 constexpr int uninit() {
285 constexpr int prev(int x) {
292 constexpr int g(int x, int n) {