[clang] [clang] Fix crashes when initializing constexpr int* with floating-point (PR #180376)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 17 22:02:50 PST 2026


================
@@ -309,10 +309,10 @@ constexpr const int *V81 = &V80;
 constexpr int *V82 = 0;
 constexpr int *V83 = V82;
 constexpr int *V84 = 42;
-// both-error at -1 {{constexpr variable 'V84' must be initialized by a constant expression}}
-// both-note at -2 {{this conversion is not allowed in a constant expression}}
-// both-error at -3 {{constexpr pointer initializer is not null}}
+// both-error at -1 {{constexpr pointer initializer is not null}}
 constexpr int *V85 = nullptr;
+constexpr int *V91 = 0.;
----------------
zwuis wrote:

> ... Unfortunately, I don't have commit access to the repository and can't implement the changes suggested. ...

You can create another PR to do it.

https://github.com/llvm/llvm-project/pull/180376


More information about the cfe-commits mailing list