Четверг, 10 июня 2021, 15:37 +03:00 от Edward Catmur <ecatmur@googlemail.com>:
On Thu, 10 Jun 2021 at 13:28, Vladimir Grigoriev via Std-Discussion <std-discussion@lists.isocpp.org> wrote:Also is it this rule valid for designated initializations?For example if we havestruct A
{
int x, z;
};struct B
{
int x, y, z;
};void g( const A & )
{
std::cout << "void g( const A & )\n";
}void g( const B & )
{
std::cout << "void g( const B & )\n";
}
then is this callg( { .x = 1, .z = 2 } );
ambiguous or the function with the parameter const A & will be called?A and B are not array types, so [over.ics.rank]/3.1.2 does not apply.Indeed, all the compilers agree that the call is ambiguous.