Skip to content

missing-field-initializers warning should NOT reporting missing designated initializers #68933

@jamesruan

Description

@jamesruan

#56628 introduce a disruptive change based on a wrong understanding about how designated initializers are meant to be used.

missing-field-initializers should report for user really missing some fields that may lead to potential error behavior.

Designated initializers are more like an extension to default initializer. It's not a kind of implicit init.

struct A {int a; int b;};
A default_init = {}; // a=0, b=0, default init all fields, not reporting warning
A designated_init = {.b=1}; // a=0, b=1, default init a, designated init b; reporting warning now, should not
A real_missing = {1}; // proper use case for this diagnosic flag

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions