[Bug c++/105841] [12/13 Regression] Change in behavior of CTAD for alias templates

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jun 6 20:12:29 GMT 2022


Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
             Status|ASSIGNED                    |NEW
                 CC|                            |mike at spertus dot com
           Assignee|jason at gcc dot gnu.org           |unassigned at gcc dot gnu.org

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
In alias_ctad_tweaks, I wrote:

  /* This implementation differs from the [standard] in two significant ways:   

     1) We include all template parameters of A, not just some.                 
     2) The added constraint is same_type instead of deducible.                 

     I believe that while it's probably possible to construct a testcase that   
     behaves differently with this simplification, it should have the same      
     effect for real uses.  Including all template parameters means that we     
     deduce all parameters of A when resolving the call, so when we're in the   
     constraint we don't need to deduce them again, we can just check whether   
     the deduction produced the desired result.  */

This testcase is an example of why my assumption above was wrong.  The effect
of the transformations specified by the standard would be roughly

template <class> struct B_deducible;
template <class BT, int BN> struct B_deducible<B<BT,BN>> { };
template <class BT, class... fTs>
auto fp(BT, fTs...) -> A<BT, sizeof...(fTs)>
  requires requires { B_deducible<A<BT,sizeof...(fTs)>>(); };

decltype(fp(0,0)) b(0,0);

which works.

A year ago, Mike Spertus had a partial fix for this; any update on that?

More information about the Gcc-bugs mailing list