[Bug c++/105925] New: [11.1 Regression] Could not convert '{{0, 0.0}}' from '<brace-enclosed initializer list>' to 'X'

jehova at existiert dot net gcc-bugzilla@gcc.gnu.org
Sat Jun 11 08:53:36 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105925

            Bug ID: 105925
           Summary: [11.1 Regression] Could not convert '{{0, 0.0}}' from
                    '<brace-enclosed initializer list>' to 'X'
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jehova at existiert dot net
  Target Milestone: ---

struct V
{
    int i;
    double d;
};

struct X
{
    union
    {
        int x;
        V y;
    };
};

X foo()
{
    return {.y = {0, 0.0}};
}

Compilation with 'g++ -std=c++20' works in 11.1 but fails for 11.2 and newer,
particularly in 12.1.

See https://godbolt.org/z/foq9aEs57

The code is also accepted by other major compilers (clang and MSVC).


More information about the Gcc-bugs mailing list