[clang] 19398ad - [Clang] Add additional tests for constexpr initialization (#181965)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 10 04:52:27 PDT 2026
Author: Samrudh Nelli
Date: 2026-03-10T12:52:22+01:00
New Revision: 19398ad4cbf02868306a48db82ea1b0a7c69bbc3
URL: https://github.com/llvm/llvm-project/commit/19398ad4cbf02868306a48db82ea1b0a7c69bbc3
DIFF: https://github.com/llvm/llvm-project/commit/19398ad4cbf02868306a48db82ea1b0a7c69bbc3.diff
LOG: [Clang] Add additional tests for constexpr initialization (#181965)
Add constexpr initialization tests for 0.0f, 0e0, 0x0p0.
Added:
Modified:
clang/test/Sema/constexpr.c
Removed:
################################################################################
diff --git a/clang/test/Sema/constexpr.c b/clang/test/Sema/constexpr.c
index 04da0f56a741d..3a6b49fd90748 100644
--- a/clang/test/Sema/constexpr.c
+++ b/clang/test/Sema/constexpr.c
@@ -313,6 +313,12 @@ constexpr int *V84 = 42;
constexpr int *V85 = nullptr;
constexpr int *V91 = 0.0;
// expected-error at -1 {{initializing 'int *const' with an expression of incompatible type 'double'}}
+constexpr int *V92 = 0.0f;
+// expected-error at -1 {{initializing 'int *const' with an expression of incompatible type 'float'}}
+constexpr int *V93 = 0e0;
+// expected-error at -1 {{initializing 'int *const' with an expression of incompatible type 'double'}}
+constexpr int *V94 = 0x0p0;
+// expected-error at -1 {{initializing 'int *const' with an expression of incompatible type 'double'}}
// Check that constexpr variables should not be VLAs.
void f6(const int P1) {
More information about the cfe-commits
mailing list