@@ -137,3 +137,61 @@ namespace ttp_defaults {
137
137
// old-error@-2 {{template template argument has different template parameters}}
138
138
// old-error@-3 {{explicit instantiation of 'f' does not refer to a function template}}
139
139
} // namespace ttp_defaults
140
+
141
+ namespace ttp_only {
142
+ template <template <class ... > class TT1 > struct A { static constexpr int V = 0 ; };
143
+ // new-note@-1 2{{template is declared here}}
144
+ template <template <class > class TT2 > struct A <TT2> { static constexpr int V = 1 ; };
145
+ // new-error@-1 {{not more specialized than the primary template}}
146
+ // new-note@-2 {{partial specialization matches}}
147
+ template <template <class , class > class TT3 > struct A <TT3> { static constexpr int V = 2 ; };
148
+ // new-error@-1 {{not more specialized than the primary template}}
149
+ // new-note@-2 {{partial specialization matches}}
150
+
151
+ template <class ... > struct B ;
152
+ template <class > struct C ;
153
+ template <class , class > struct D ;
154
+ template <class , class , class > struct E ;
155
+
156
+ static_assert (A<B>::V == 0 ); // new-error {{ambiguous partial specializations}}
157
+ static_assert (A<C>::V == 1 );
158
+ static_assert (A<D>::V == 2 );
159
+ static_assert (A<E>::V == 0 );
160
+ } // namespace ttp_only
161
+
162
+ namespace consistency {
163
+ template <class T > struct nondeduced { using type = T; };
164
+ template <class T8 , class T9 = float > struct B ;
165
+
166
+ namespace t1 {
167
+ template <class T1 , class T2 , class T3 > struct A ;
168
+
169
+ template <template <class , class > class TT1 ,
170
+ class T1 , class T2 , class T3 , class T4 >
171
+ struct A <TT1<T1, T2>, TT1<T3, T4>, typename nondeduced<TT1<T1, T2>>::type> {};
172
+
173
+ template <template <class > class UU1 ,
174
+ template <class > class UU2 ,
175
+ class U1 , class U2 >
176
+ struct A <UU1<U1>, UU2<U2>, typename nondeduced<UU1<U1>>::type>;
177
+
178
+ template struct A <B<int >, B<int >, B<int >>;
179
+ } // namespace t1
180
+ namespace t2 {
181
+ template <class T1 , class T2 , class T3 > struct A ;
182
+
183
+ template <template <class , class > class TT1 ,
184
+ class T1 , class T2 , class T3 , class T4 >
185
+ struct A <TT1<T1, T2>, TT1<T3, T4>, typename nondeduced<TT1<T1, T4>>::type> {};
186
+ // new-note@-1 {{partial specialization matches}}
187
+
188
+ template <template <class > class UU1 ,
189
+ template <class > class UU2 ,
190
+ class U1 , class U2 >
191
+ struct A <UU1<U1>, UU2<U2>, typename nondeduced<UU1<U1>>::type>;
192
+ // new-note@-1 {{partial specialization matches}}
193
+
194
+ template struct A <B<int >, B<int >, B<int >>;
195
+ // new-error@-1 {{ambiguous partial specializations}}
196
+ } // namespace t1
197
+ } // namespace consistency
0 commit comments