I have a piece of code that does not compile since I started compiling with [c++ language standard] stdcpp20 instead of stdcpp17 in visual studio.
I receive an error
cannot convert from 'initializer list' to 'foo'
Find below a minimal reproduceable exemple.
struct foo {
foo(const foo&) = default; // comment this line to compile
char a;
};
int main(int argc, char* argv[])
{
foo{ 'a' }; // error: cannot convert from 'initializer list' to 'foo'
}
Commenting the copy constructor helps. But I don't understand why and I haven't found it on SO yet.