summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2019-08-19 17:39:59 +0000
committerErich Keane <erich.keane@intel.com>2019-08-19 17:39:59 +0000
commit62b072d413eed260fb526df5edd87691a66f0c60 (patch)
tree9d5b34861b30db6ec934fe00ee977694cb79ef6f /clang/test
parent296757c07ccc66a5d5a8f3f7cbc769faef49cfd9 (diff)
downloadbcm5719-llvm-62b072d413eed260fb526df5edd87691a66f0c60.tar.gz
bcm5719-llvm-62b072d413eed260fb526df5edd87691a66f0c60.zip
Implement P1668R1
Allow inline assembly statements in unexecuted branches of constexpr functions. llvm-svn: 369281
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp8
-rw-r--r--clang/test/Lexer/cxx-features.cpp2
-rw-r--r--clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp5
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
OpenPOWER on IntegriCloud