Issue 83732
Summary `modernize-use-designated-initializers` reported for pre-C++20 code
Labels new issue
Assignees
Reporter firewave
    ```cpp
struct S
{
    int i1;
 int i2;
};

void f()
{
    S s{0};
}
```

Running with `-std=c++11` produces the following warning:
```
<source>:9:8: warning: use designated initializer list to initialize 'S' [modernize-use-designated-initializers]
    9 |     S s{0};
      | ^~~
      |         .i1=
<source>:1:1: note: aggregate type is defined here
    1 | struct S
      | ^
```

https://godbolt.org/z/EzerEWsKh

Designated initializers are not available until C++20: https://en.cppreference.com/w/cpp/language/aggregate_initialization.

CC @SimplyDanny @PiotrZSL 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to