https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108114
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang gives:
<source>:11:19: warning: mixture of designated and non-designated initializers
in the same initializer list is a C99 extension [-Wc99-designator]
B b{{.a = 0}, .b = 1};
^~~~~~
<source>:11:9: note: first non-designated initializer is here
B b{{.a = 0}, .b = 1};
^~~~~~~~
With -std=c++17 -pedantic GCC produces:
<source>: In function 'int main()':
<source>:11:10: warning: C++ designated initializers only available with
'-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
11 | B b{{.a = 0}, .b = 1};
| ^
<source>:11:19: warning: C++ designated initializers only available with
'-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
11 | B b{{.a = 0}, .b = 1};
| ^
In GCC 7 (and before) -std=c++17 -pedantic GCC gives:
<source>: In function 'int main()':
<source>:11:9: warning: ISO C++ does not allow C99 designated initializers
[-Wpedantic]
B b{{.a = 0}, .b = 1};
^
<source>:11:17: warning: ISO C++ does not allow C99 designated initializers
[-Wpedantic]
B b{{.a = 0}, .b = 1};
^
Most likely just a difference between C99 and C++20 support.
Also note "but this is not an error" is because if you use -pedantic-errors you
would get an error with clang and even GCC with -std=c++17.