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

            Bug ID: 101803
           Summary: CTAD fails for nested designated initializers
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: h2+bugs at fsfe dot org
  Target Milestone: ---

See the code below. Two initializing statements fail to build, although they
shouldn't influence CTAD of the outer type at all (IMHO).

struct Inner
{
    int i = 0;
};

struct Outer2
{
    Inner s{};
};

template <typename T = int>
struct Outer
{
    Inner s{};
};

int main()
{
    Outer2 o21{ .s = {} };                // works
    Outer2 o22{ .s = Inner{ .i = 1} };    // works
    Outer2 o23{ .s = { .i = 1} };         // works

    Outer2 o24{ .s{} };                   // works
    Outer2 o25{ .s{Inner{ .i = 1} } };    // works
    Outer2 o26{ .s{ .i = 1} };            // works

    Outer o1{ .s = {} };                // works
    Outer o2{ .s = Inner{ .i = 1} };    // works
//    Outer o3{ .s = { .i = 1} };         // does not

    Outer o4{ .s{} };                   // works
    Outer o5{ .s{Inner{ .i = 1} } };    // works
//    Outer o6{ .s{ .i = 1} };            // does not
}

Reply via email to