https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110122
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> --- (In reply to waffl3x from comment #3) > Very cool, thanks, since your test case seems to cause problems in GCC 11 > and GCC 12 does that mean the bug goes deeper than I thought? > > (In reply to Patrick Palka from comment #2) > > It seems only the first testcase exhibits a 13 regression, we never accepted > > the second testcase. > > Is that what you meant here btw, that since your second test case triggers > the bug in 11 and 12 that it belongs as a different regression test? 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). > > Sadly, the workaround doesn't work when `Bar` is a class template. > https://godbolt.org/z/41xWrar5e > So it doesn't work in my specific case :( Ah, does it work for you to give Bar an explicitly defaulted copy and default ctor?