On Tue, 8 Mar 2022, Jason Merrill wrote:

> On 3/2/22 14:32, Patrick Palka wrote:
> > In order to be able to perform CTAD for a dependently-scoped template
> > such as A<T>::B in the testcase below, we need to permit a
> > typename-specifier to resolve to a template as per [dcl.type.simple]/2,
> > at least when it appears in a CTAD-enabled context.
> > 
> > This patch implements this using a new tsubst flag tf_tst_ok to control
> > when a TYPENAME_TYPE is allowed to name a template, and sets this flag
> > when substituting into the type of a CAST_EXPR, CONSTRUCTOR or VAR_DECL
> > (each of which is a CTAD-enabled context).
> 
> What breaks if we always allow that, or at least in -std that support CTAD?

AFAICT no significant breakage, but some accepts-invalid and diagnostic
regressions crop up, e.g. accepts-invalid for

  using type = typename A<T>::B; // no more diagnostic if typename resolves to a
                                 // template at instantiation time

and diagnostic regression for

  template<class T, class = typename A<T>::B> void f();
  // no more elaboration why deduction failed if typename resolves
  // to a template

Reply via email to