[llvm-branch-commits] [clang] 88790ee - [Clang] add long double test to cover constant expression evaluation (#175645)
Cullen Rhodes via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jan 13 02:21:08 PST 2026
Author: Oleksandr T.
Date: 2026-01-13T10:18:54Z
New Revision: 88790ee307b122d4aec6cafa2061cce1140bbe4a
URL: https://github.com/llvm/llvm-project/commit/88790ee307b122d4aec6cafa2061cce1140bbe4a
DIFF: https://github.com/llvm/llvm-project/commit/88790ee307b122d4aec6cafa2061cce1140bbe4a.diff
LOG: [Clang] add long double test to cover constant expression evaluation (#175645)
Fixes
https://github.com/llvm/llvm-project/pull/174113#discussion_r2683013358
---
This patch adds a test to cover the `long double` case during constant
expression evaluation
Added:
Modified:
clang/test/Sema/constexpr.c
Removed:
################################################################################
diff --git a/clang/test/Sema/constexpr.c b/clang/test/Sema/constexpr.c
index 16255c264423a..b5b62863cfdad 100644
--- a/clang/test/Sema/constexpr.c
+++ b/clang/test/Sema/constexpr.c
@@ -402,10 +402,17 @@ bool issue155507(v2int16_t a, v2int16_t b) {
constexpr bool b2 = (bool)nullptr;
_Static_assert(!b2);
-double ghissue173847(double a) {
+double gh173847_double(double a) {
double result = 3.0 / (a + 4.5 - 2.1 * 0.7);
return result;
}
-void ghissue173847_test() {
- constexpr float f_const = ghissue173847(2.0); // expected-error {{constexpr variable 'f_const' must be initialized by a constant expression}}
+
+long double gh173847_long_double(long double a) {
+ long double result = 3.0L / (a + 4.5L - 2.1L * 0.7L);
+ return result;
+}
+
+void gh173847_test() {
+ constexpr double d_const = gh173847_double(2.0); // expected-error {{constexpr variable 'd_const' must be initialized by a constant expression}}
+ constexpr long double ld_const = gh173847_long_double(2.0L); // expected-error {{constexpr variable 'ld_const' must be initialized by a constant expression}}
}
More information about the llvm-branch-commits
mailing list