[clang] [Clang] Consider reachability for file-scope warnings on initializers (PR #163885)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 17 07:53:44 PDT 2025
================
@@ -13100,6 +13100,13 @@ namespace {
if (isa<ParmVarDecl>(OrigDecl))
return;
+ // Skip checking for file-scope constexpr variables - constant evaluation
+ // will produce appropriate errors without needing runtime diagnostics.
+ // Local constexpr should still emit runtime warnings.
+ if (auto *VD = dyn_cast<VarDecl>(OrigDecl))
+ if (VD->isConstexpr() && VD->isFileVarDecl())
----------------
zwuis wrote:
```cpp
if (auto *VD = ...;
VD && ...)
```
https://github.com/llvm/llvm-project/pull/163885
More information about the cfe-commits
mailing list