jcsxky wrote:

> I don't think this is the right approach. I stepped though the example and 
> the reason we reject is because:
> 
> * We substitute a dependent `AutoType` in for the types of the template 
> parameters when they are initially built.
> * We call `getMoreSpecialized` determine whether the partial specialization 
> is more specialized than the primary.
> * We determine that neither template is at least as specialized as the other 
> via `isAtLeastAsSpecializedAs`.
> * We call `TemplateParameterListsAreEqual` per [[temp.func.order] 
> p6.2.2](http://eel.is/c++draft/temp.func.order#6.2.2) to check for template 
> parameter equivalence, and compare the two template parameters by calling 
> `MatchTemplateParameterKind`.
> * `MatchTemplateParameterKind` calls `ASTContext::getUnconstrainedType` to 
> get the unconstrained type of the template parameters per [[temp.over.link] 
> p6 sentence 2](http://eel.is/c++draft/temp.over.link#6.sentence-2). For the 
> class templates template parameter, it returns the type unchanged (a 
> _**dependent**_ `AutoType`). For the class template partial specializations 
> template parameter, it returns an unconstrained `AutoType` _**that isn't 
> dependent**_.
> * We compare the adjusted types and determine they aren't equal, so we 
> consider neither template to be more specialized than the other.
> 
> So, I think the correct fix is to propagate dependence in 
> `ASTContext::getUnconstrainedType`. I have a branch that implements this 
> [here](https://github.com/sdkrystian/llvm-project/tree/partial-spec-dependent-auto).
>  WDYT @erichkeane @cor3ntin @zyn0217?

This is really a perfect approach and it has addressed the underlying issue. 
And thanks for your explaination! 

https://github.com/llvm/llvm-project/pull/91842
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to