Skip to content

Commit 8717629

Browse files
committed
[clang] Evaluate constant initializers in C as well
1 parent 8178d3c commit 8717629

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14481,7 +14481,8 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
1448114481
// do this lazily, because the result might depend on things that change
1448214482
// later, such as which constexpr functions happen to be defined.
1448314483
SmallVector<PartialDiagnosticAt, 8> Notes;
14484-
if (!getLangOpts().CPlusPlus11 && !getLangOpts().C23) {
14484+
if (getLangOpts().CPlusPlus && !getLangOpts().CPlusPlus11 &&
14485+
!getLangOpts().C23) {
1448514486
// Prior to C++11, in contexts where a constant initializer is required,
1448614487
// the set of valid constant initializers is described by syntactic rules
1448714488
// in [expr.const]p2-6.

0 commit comments

Comments
 (0)