This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
structNonLiteral { // cxx2a-note {{'NonLiteral' is not literal}} \
// cxx2b-note 2{{'NonLiteral' is not literal}}
// cxx23-note 2{{'NonLiteral' is not literal}}
NonLiteral() {}
};
Expand All
@@ -12,50 +12,50 @@ struct Constexpr{};
constexprintf(int n) { // expected-error {{constexpr function never produces a constant expression}}
staticconstint m = n; // expected-note {{control flows through the definition of a static variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexprintg(int n) { // expected-error {{constexpr function never produces a constant expression}}
thread_localconstint m = n; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexprintc_thread_local(int n) { // expected-error {{constexpr function never produces a constant expression}}
static _Thread_local int m = 0; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexprintgnu_thread_local(int n) { // expected-error {{constexpr function never produces a constant expression}}
static __thread int m = 0; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexprinth(int n) { // expected-error {{constexpr function never produces a constant expression}}
staticconstint m = n; // expected-note {{control flows through the definition of a static variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return &m - &m;
}
constexprinti(int n) { // expected-error {{constexpr function never produces a constant expression}}
thread_localconstint m = n; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
return &m - &m;
}
constexprintj(int n) {
if (!n)
return0;
staticconstint m = n; //cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
staticconstint m = n; //cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexprint j0 = j(0);
constexprintk(int n) {
if (!n)
return0;
thread_localconstint m = n; //cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
thread_localconstint m = n; //cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
Expand All
@@ -65,7 +65,7 @@ constexpr int j_evaluated(int n) {
if (!n)
return0;
staticconstint m = n; // expected-note {{control flows through the definition of a static variable}} \
// cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
Expand All
@@ -76,7 +76,7 @@ constexpr int k_evaluated(int n) {
if (!n)
return0;
thread_localconstint m = n; // expected-note {{control flows through the definition of a thread_local variable}} \
// cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
Expand All
@@ -85,21 +85,21 @@ constexpr int ke = k_evaluated(1); // expected-error {{constexpr variable 'ke' m
// expected-note {{in call}}
constexprintstatic_constexpr() {
staticconstexprint m = 42; //cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
staticconstexpr Constexpr foo; //cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
staticconstexprint m = 42; //cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
staticconstexpr Constexpr foo; //cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexprintthread_local_constexpr() {
thread_localconstexprint m = 42; //cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
thread_localconstexpr Constexpr foo; //cxx2b-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++2b}}
thread_localconstexprint m = 42; //cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
thread_localconstexpr Constexpr foo; //cxx23-warning {{definition of a thread_local variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
constexprintnon_literal(bool b) {
if (!b)
return0;
NonLiteral n; //cxx2b-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++2b}}
NonLiteral n; //cxx23-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++23}}
}
constexprint non_literal_1 = non_literal(false);
Expand All
@@ -111,7 +111,7 @@ constexpr int f(int x) {
return0;
} else {
goto test; // expected-note {{subexpression not valid in a constant expression}} \
// cxx2b-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
}
test:
return0;
Expand All
@@ -124,7 +124,7 @@ constexpr int c = f(1);
constexprintlabel() {
test: //cxx2b-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++2b}}
test: //cxx23-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
return0;
}
Expand All
@@ -138,14 +138,14 @@ constexpr int d = label();
// This is to be contrasted with the test for implicitly constexpr lambdas below.
inttest_in_lambdas() {
auto a = []() constexpr {
staticconstint m = 32; //cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
staticconstint m = 32; //cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
};
auto b = [](int n) constexpr {
if (!n)
return0;
staticconstint m = n; //cxx2b-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++2b}}
staticconstint m = n; //cxx23-warning {{definition of a static variable in a constexpr function is incompatible with C++ standards before C++23}}
return m;
}
(1);
Expand All
@@ -155,7 +155,7 @@ int test_in_lambdas() {
return0;
else
goto test; // expected-note {{subexpression not valid in a constant expression}} \
// cxx2b-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++2b}}
// cxx23-warning {{use of this statement in a constexpr function is incompatible with C++ standards before C++23}}
test:
return1;
};
Expand All
@@ -165,15 +165,15 @@ int test_in_lambdas() {
auto non_literal = [](bool b) constexpr {
if (!b)
NonLiteral n; //cxx2b-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}} \
// cxx2a-error {{variable of non-literal type 'NonLiteral' cannot be defined in a constexpr function before C++2b}} \
// cxx2b-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++2b}}
NonLiteral n; //cxx23-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}} \
// cxx2a-error {{variable of non-literal type 'NonLiteral' cannot be defined in a constexpr function before C++23}} \
// cxx23-warning {{definition of a variable of non-literal type in a constexpr function is incompatible with C++ standards before C++23}}
return0;
};
#if __cplusplus > 202002L
constexprauto non_literal_ko = non_literal(false); //cxx2b-error {{constexpr variable 'non_literal_ko' must be initialized by a constant expression}} \
// cxx2b-note {{in call}}
constexprauto non_literal_ko = non_literal(false); //cxx23-error {{constexpr variable 'non_literal_ko' must be initialized by a constant expression}} \
// cxx23-note {{in call}}
constexprauto non_literal_ok = non_literal(true);
#endif
Expand All
@@ -187,7 +187,7 @@ int test_lambdas_implicitly_constexpr() {
auto b = [](int n) { // cxx2a-note 2{{declared here}}
if (!n)
return0;
staticconstint m = n; //cxx2b-note {{control flows through the definition of a static variable}}
staticconstint m = n; //cxx23-note {{control flows through the definition of a static variable}}
return m;
};
Expand All
@@ -197,13 +197,13 @@ int test_lambdas_implicitly_constexpr() {
constexprauto b3 = b(1); // expected-error{{constexpr variable 'b3' must be initialized by a constant expression}} \
// cxx2a-note {{non-constexpr function}} \
// cxx2b-note {{in call}}
// cxx23-note {{in call}}
auto c = [](int n) { // cxx2a-note 2{{declared here}}
if (!n)
return0;
else
goto test; //cxx2b-note {{subexpression not valid in a constant expression}}
goto test; //cxx23-note {{subexpression not valid in a constant expression}}
test:
return1;
};
Expand All
@@ -213,17 +213,17 @@ int test_lambdas_implicitly_constexpr() {
constexprauto c_error = c(1); // expected-error {{constexpr variable 'c_error' must be initialized by a constant expression}} \
// cxx2a-note {{non-constexpr function}} \
// cxx2b-note {{in call to}}
// cxx23-note {{in call to}}
auto non_literal = [](bool b) { // cxx2a-note 2{{declared here}}
if (b)
NonLiteral n; //cxx2b-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}}
NonLiteral n; //cxx23-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}}
return0;
};
constexprauto non_literal_ko = non_literal(true); // expected-error {{constexpr variable 'non_literal_ko' must be initialized by a constant expression}} \
// cxx2a-note {{non-constexpr function}} \
// cxx2b-note {{in call}}
// cxx23-note {{in call}}
constexprauto non_literal_ok = non_literal(false); // cxx2a-error {{must be initialized by a constant expression}} \
// cxx2a-note {{non-constexpr function}}
Expand All
@@ -238,8 +238,8 @@ constexpr auto dependent_var_def_lambda() {
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[&] __private {} (); // expected-error{{no matching function for call to object of type '(lambda at}} expected-note{{candidate function not viable: 'this' object is in default address space, but method expects object in address space '__private'}}
#if __cplusplus <= 202002L
// expected-warning@-2{{lambda without a parameter clause is a C++2b extension}}
// expected-warning@-2{{lambda without a parameter clause is a C++23 extension}}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters