<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/111542>111542</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang++] do not emit missing braces warning if all initializers are missing the same number of braces
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          t3nsor
      </td>
    </tr>
</table>

<pre>
    Currently `-Wmissing-braces` is disabled in some useful cases (see [here](https://github.com/llvm/llvm-project/blob/main/clang/test/SemaCXX/aggregate-initialization.cpp#L155)).

However the current rules still emit a warning in cases such as
```
struct A {
    int x;
};
struct B {
    int y;
};
struct S : A, B {
};
int main() {
    S s = {1, 2};
}
```
This pattern is used to implement an aggregate tuple template (templating has been omitted from this example for the sake of simplicity) which is useful in cases where tuples must be able to contain immovable types such as in senders & receivers based execution libraries.

I would like to suggest a generalization of the current rules that would avoid the warning in the example above: if all initializers provided are missing the same number of enclosing pairs of braces, then don't emit the warning. So in the `std::array` case there would be no warning because an outer pair of braces is missing, while in the above tuple case each initializer would be missing an inner pair of braces. Note that under this rule there would no longer be a warning for the `AggregateAndEmpty` case in `aggregate-initialization.cpp` but maybe there is a refinement of the rule that would preserve the warning in that case.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlc2O4zYMx59GuRATOMrYkxxyyEwatEDRyxToXiWbsdmVJUOUkk2fvqDtJLOYxRYFjMT6MMk_-aNkmKn1iDtVvqrysDA5dSHu0tpziAsbmuvuLceIPrkrqKp4-qsnZvLtk42mRlZVAcTQEBvrsAHywKFHyIyn7KA2jAxKbxgRVPnaYURVHpTedCkNrNZ7pY9KH1tKXbbLOvRKH5073_6ehhj-xjopfbQuWKWPvSGv9LF2xrdKHxOyLL5jb96-fFH6aNo2YmsSPpGnRMbRPyZR8Mt6GJRe_74qS6W3Sm-XqjioYj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