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

--- Comment #5 from waffl3x <waffl3x at protonmail dot com> ---
(In reply to Patrick Palka from comment #4)
> 
> Yes, it seems the original testcase is exhibiting two bugs (one of which a
> GCC 13 regression), whereas the second testcase exhibits one
> (non-regression) bug.
> 
> In your original testcase Bar's copy constructor shouldn't be needed since
> the template parameter V isn't being copied anywhere, but we're somehow end
> up with an illegitimate use of the constructor (bug #1) and then we're also
> failing to synthesize it (bug #2).
> 
> In the second testcase Bar's copy constructor is legitimately needed since
> we're arguably making a copy of V when writing the specialization
> Doppelganger<V>, but we fail to synthesize the constructor (bug #2).
> 

Ah okay got it, bug #1 is pretty harmless then isn't it, because there should
never be a situation where the illegitimate use of the constructor will be an
error, it only popped up because bug #2 happened.
On the other hand, this makes me wonder about what's going on during class
template instantiation, at worst it's probably an inefficiency rather than
anything potentially harmful though.
> 
> Ah, does it work for you to give Bar an explicitly defaulted copy and
> default ctor?
Yes actually, that does seem to do the trick.
https://godbolt.org/z/x7eYzY6dz

Reply via email to