We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 50c5704 commit 261b2d5Copy full SHA for 261b2d5
clang/lib/Sema/SemaInit.cpp
@@ -6620,7 +6620,7 @@ void InitializationSequence::InitializeFrom(Sema &S,
6620
// initializer present. However, we only do this for structure types, not
6621
// union types, because an unitialized field in a union is generally
6622
// reasonable, especially in C where unions can be used for type punning.
6623
- if (!Initializer && !Rec->isUnion() && !Rec->isInvalidDecl()) {
+ if (Var && !Initializer && !Rec->isUnion() && !Rec->isInvalidDecl()) {
6624
if (const FieldDecl *FD = getConstField(Rec)) {
6625
unsigned DiagID = diag::warn_default_init_const_field_unsafe;
6626
if (Var->getStorageDuration() == SD_Static ||
0 commit comments