[Bug c++/82235] Copy ctor is not found for copying array of an object when it's marked explicit

mwinkler at blizzard dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 15 00:19:27 GMT 2026


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

--- Comment #6 from Max Enrico Winkler <mwinkler at blizzard dot com> ---
Also ran into another case where GCC doesn't consider explicit copy
constructors.
Should be valid according to
https://eel.is/c++draft/expr.prim.lambda.capture#15.

https://godbolt.org/z/74Ghqvse9

```
struct Foo
{
    Foo() = default;

    explicit Foo(const Foo&);
};

int main()
{
    Foo f;

    auto l = [c(f)] () {};
    l();
}
```

A workaround here is trivial atleast
```
auto l = [c = Foo(f)] () {};
```


More information about the Gcc-bugs mailing list