Skip to content

Commit

Permalink
Extend the comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Fznamznon committed Oct 17, 2024
1 parent c40ea63 commit d1406be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2620,7 +2620,9 @@ bool VarDecl::hasICEInitializer(const ASTContext &Context) const {
}

bool VarDecl::hasConstantInitialization() const {
// In C, all globals (and only globals) have constant initialization.
// In C, all globals and constexpr variables should have constant
// initialization. For constexpr variables in C check that initializer is a
// constant initializer because they can be used in constant expressions.
if (hasGlobalStorage() && !getASTContext().getLangOpts().CPlusPlus &&
!isConstexpr())
return true;
Expand Down

0 comments on commit d1406be

Please sign in to comment.