================
@@ -79,14 +79,14 @@ template<C     T, int I> struct Y2<T*, I, I+1+1> {}; // 
expected-note {{partial
 template<C T, C auto I, int W, A S, template<typename, auto, int, A, 
typename...> class U, typename... Z>
 struct Y3 { Y3()=delete; };
 template<C T, D auto I, int W, A S, template<typename, auto, int, A, 
typename...> class U, typename... Z>
-struct Y3<T, I, W, S, U, Z...> { Y3()=delete; };
+struct Y3<T, I, W, S, U, Z...> { Y3()=delete; }; // expected-note {{partial 
specialization matches [with T = int, I = 1, W = 1, S = A{}, U = S, Z = <int>]}}
 template<C T, E auto I, int W, A S, template<typename, auto, int, A, 
typename...> class U, typename... Z>
-struct Y3<T, I, W, S, U, Z...> {};
+struct Y3<T, I, W, S, U, Z...> {}; // expected-note {{partial specialization 
matches [with T = int, I = 1, W = 1, S = A{}, U = S, Z = <int>]}}
 
 void f() {
   Y1<int, 2> a;
   Y2<char*, 1, 3> b; // expected-error {{ambiguous partial specializations}}
-  Y3<int, 1, 1, A{}, S, int> c;
+  Y3<int, 1, 1, A{}, S, int> c; // expected-error {{ambiguous partial 
specializations of 'Y3<int, 1, 1, A{}, S, int>'}}
----------------
jcsxky wrote:

When instantiation, we are checking which one of the two partial specialization 
is more specialized. Obviously, the first one(`auto D`) is not more specialized 
than the second(`auto E`). When applied this patch, the second one is not more 
specialized than the first as well. This is because `isSameTemplateArg` return 
`false` and the result is not `TemplateDeductionResult::Success`.
Although we get correct result, it is not because of ignoring the 
type-constraint. Back to the quote, if we ignore the use of type-constraints 
for placeholder types, is the following example ill-formed due to their 
equivalent template arguments?
```cpp
template <typename> constexpr bool True = true;
template <typename T> concept C = True<T>;
template <typename T> concept D = C<T> && sizeof(T) > 2;
template <typename T> concept E = D<T> && alignof(T) > 1;

template<C auto I>
struct Y3 { Y3()=delete; };

template<D auto I>
struct Y3<I> { Y3()=delete; }; 

template<E auto I>
struct Y3<I> {};
```
But EDG, gcc and MSVC all accept this code. So I think the existing test is 
rejected may not be related to the quote. WDYT? @cor3ntin @zyn0217 @erichkeane 

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