diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-03-31 18:53:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-31 18:53:12 +0200 |
commit | a0e1e680d28c4ef5f87be948d1d223fbfda2950c (patch) | |
tree | 02b1f4ad02bb47a58a47d0a2e233506421a94e50 /clang/test/AST/ByteCode/builtin-functions.cpp | |
parent | 11dd7d98a6ecd2374289b6a217e358e503d4778a (diff) | |
download | llvm-a0e1e680d28c4ef5f87be948d1d223fbfda2950c.zip llvm-a0e1e680d28c4ef5f87be948d1d223fbfda2950c.tar.gz llvm-a0e1e680d28c4ef5f87be948d1d223fbfda2950c.tar.bz2 |
[clang][bytecode] Return Invalid() on non-constexpr builtins (#133700)
So the diagnostic output matches with the current interpreter
Diffstat (limited to 'clang/test/AST/ByteCode/builtin-functions.cpp')
-rw-r--r-- | clang/test/AST/ByteCode/builtin-functions.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index 8408286..40f7a18 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -1591,3 +1591,12 @@ namespace WMemChr { constexpr bool c = !wcschr(L"hello", L'h'); // both-error {{constant expression}} \ // both-note {{non-constexpr function 'wcschr' cannot be used in a constant expression}} } + +namespace Invalid { + constexpr int test() { // both-error {{never produces a constant expression}} + __builtin_abort(); // both-note 2{{subexpression not valid in a constant expression}} + return 0; + } + static_assert(test() == 0); // both-error {{not an integral constant expression}} \ + // both-note {{in call to}} +} |