diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp | 8 | ||||
| -rw-r--r-- | clang/test/Lexer/cxx-features.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp | 5 |
3 files changed, 11 insertions, 4 deletions
diff --git a/clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp b/clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp index dd26f691569..f72984a6a12 100644 --- a/clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp +++ b/clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp @@ -136,9 +136,13 @@ constexpr int AllowedStmtsCXX11() { } // or a compound-statement that does not contain [CXX1Y] -constexpr int DisallowedStmtsCXX1Y_1() { +constexpr int DisallowedStmtsCXX1Y_1(bool b) { // - an asm-definition - asm("int3"); // expected-error {{statement not allowed in constexpr function}} + if (b) + asm("int3"); +#if !defined(CXX2A) + // expected-error@-2 {{use of this statement in a constexpr function is a C++2a extension}} +#endif return 0; } constexpr int DisallowedStmtsCXX1Y_2() { diff --git a/clang/test/Lexer/cxx-features.cpp b/clang/test/Lexer/cxx-features.cpp index 75d6e0aa14d..a8ef6291f4c 100644 --- a/clang/test/Lexer/cxx-features.cpp +++ b/clang/test/Lexer/cxx-features.cpp @@ -203,7 +203,7 @@ #error "wrong value for __cpp_lambdas" #endif -#if check(constexpr, 0, 200704, 201304, 201603, 201603) +#if check(constexpr, 0, 200704, 201304, 201603, 201907) #error "wrong value for __cpp_constexpr" #endif diff --git a/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp b/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp index 12fbcfcf44a..6c773f22541 100644 --- a/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp +++ b/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp @@ -23,7 +23,10 @@ namespace ns1 { } // end ns1 namespace ns2 { - auto L = [](int I) constexpr { asm("non-constexpr"); }; //expected-error{{not allowed in constexpr function}} + auto L = [](int I) constexpr { if (I == 5) asm("non-constexpr"); }; +#if __cpp_constexpr < 201907L + //expected-error@-2{{use of this statement in a constexpr function is a C++2a extension}} +#endif } // end ns1 // This is not constexpr until C++20, as the requirements on constexpr |

