Struct literals limitation
Atila Neves
atila.neves at gmail.com
Mon Nov 16 14:17:14 UTC 2020
On Monday, 16 November 2020 at 10:22:49 UTC, Jack Applegame wrote:
>
> Valid C++14:
>> auto foo() {
>> struct Foo {
>> int a, b;
>> };
>> return Foo({
>> .a = 10,
>> .b = 20
>> });
>> }
Nope:
/tmp % clang++ -c -std=c++14 -pedantic cpp.cpp
1 :(
cpp.cpp:6:13: warning: designated initializers are a C++20
extension [-Wc++20-designator]
.a = 10,
^
1 warning generated.
More information about the Digitalmars-d
mailing list