================ @@ -936,19 +940,21 @@ Expr *buildIsDeducibleConstraint(Sema &SemaRef, Context.DeclarationNames.getCXXDeductionGuideName(AliasTemplate)); }; + TemplateDecl *TD = DeducingTemplate ? DeducingTemplate : AliasTemplate; + SmallVector<TypeSourceInfo *> IsDeducibleTypeTraitArgs = { Context.getTrivialTypeSourceInfo( Context.getDeducedTemplateSpecializationType( - TemplateName(AliasTemplate), /*DeducedType=*/QualType(), + TemplateName(TD), /*DeducedType=*/QualType(), ---------------- hokein wrote:
Thanks for the detailed analysis. > I think you're right that the `is_deducible` constraint is technically > unnecessary-- as far as I can tell, any case where this constraint would fail > would cause the `CC<R>::type` instantiation to fail before the constraint is > evaluated. There are some other caveats with removing it, however. Consider > this example: > > ```c++ > template<typename T> > struct Base1 { }; > > template<typename T> > struct Base2 { }; > > template<typename T = int> > struct Derived : public Base1<T>, Base2<T> { > using Base1<T>::Base1; > using Base2<T>::Base2; > }; > > Derived d; > ``` > > https://godbolt.org/z/4YcdvTMov > > Under > [[over.match.best.general]p2.5](https://eel.is/c++draft/over.match.best.general#2.5) > (and more specifically > [[temp.func.order]p6.4](https://eel.is/c++draft/temp.func.order#6.4)), the > bases' deduction guides are more specialized than any from `Derived` (due to > the `is_deducible` constraint), and so the implementation as it is sees this > as ambiguous. Hmm, this is an interesting case. I think this is valid code, and it is accept by all compilers in C++ 20 (or before) mode. Now we reject it in C++23, this seems like a regression, https://godbolt.org/z/zxx4W36zq. Removing the constraint seems to result in a reasonable behavior, at least this case will be compilable in C++23. We should probably ask CWG for clarifications. @cor3ntin what's the best way to do that? https://github.com/llvm/llvm-project/pull/98788 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits