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

            Bug ID: 82235
           Summary: Copy ctor is not found for copying array of an object
                    when it's marked explicit
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gnu-9fbaow at upsuper dot org
  Target Milestone: ---

See the following code:

struct Foo {
    Foo() {}
    explicit Foo(const Foo& aOther) {}
};
struct Bar {
    Foo m[1];
};
void test() {
    Bar a;
    Bar b = a;
}

GCC fails to compile it and reports:
> error: no matching function for call to 'Foo::Foo(const Foo&)'

MSVC and Clang both work fine on this case.

Removing "explicit" in Foo works, but given that removing "[1]" in Bar also
works, "explicit" on copy ctor shouldn't affect anything here.

Reply via email to