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

            Bug ID: 106788
           Summary: GCC rejects valid program involving initialization of
                    array in member initializer list
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

The following valid program is rejected by gcc 9.3 but accepted by gcc 9.4 and
onwards. Demo link: https://godbolt.org/z/KT3GWP677

```

struct A {
  A(int aa) : a(aa) {}

  A(const A &a) = delete;
  A &operator=(const A &a) = delete;

private:
  int a;
  std::vector<int> v;
};


struct B2 {
  B2()
    : a2{{1}, {2}} // -> error: use of deleted function 'A::A(const A&)' (gcc
9.3)
  {} 

private:
  A a2[2];
};

```

Reply via email to