[clang] [clang] Evaluate constant initializers in C as well (PR #121950)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 7 07:22:30 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/121950.diff
1 Files Affected:
- (modified) clang/lib/Sema/SemaDecl.cpp (+2-1)
``````````diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 4001c4d263f1d2..ff334e9d52b9dd 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -14481,7 +14481,8 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
// do this lazily, because the result might depend on things that change
// later, such as which constexpr functions happen to be defined.
SmallVector<PartialDiagnosticAt, 8> Notes;
- if (!getLangOpts().CPlusPlus11 && !getLangOpts().C23) {
+ if (getLangOpts().CPlusPlus && !getLangOpts().CPlusPlus11 &&
+ !getLangOpts().C23) {
// Prior to C++11, in contexts where a constant initializer is required,
// the set of valid constant initializers is described by syntactic rules
// in [expr.const]p2-6.
``````````
</details>
https://github.com/llvm/llvm-project/pull/121950
More information about the cfe-commits
mailing list