===================================================================
@@ -18616,15 +18616,10 @@ most_specialized_class (tree type, tree tmpl, tsub
if (spec_tmpl == error_mark_node)
return error_mark_node;
- ++processing_template_decl;
-
tree parms = DECL_INNERMOST_TEMPLATE_PARMS (spec_tmpl);
spec_args = get_class_bindings (tmpl, parms,
partial_spec_args,
args);
-
- --processing_template_decl;
-
if (spec_args)
{
if (outer_args)
===================================================================
@@ -0,0 +1,29 @@
+// PR c++/58932
+// { dg-do compile { target c++11 } }
+
+using nullptr_t = decltype(nullptr);
+
+template<typename T, typename Sfinae = nullptr_t>
+struct B {
+ static float& int_if_addable();
+};
+
+template<typename T>
+struct B<T, decltype( (T() + T()), nullptr )> {
+ static int& int_if_addable();
+};
+
+struct X { };
+
+struct Y { };
+Y operator+(Y, Y);
+
+struct Z { };
+Z operator+(Z, Z) = delete;
+
+int main()
+{
+ float& a = B<X>::int_if_addable();
+ int& b = B<Y>::int_if_addable();
+ float& c = B<Z>::int_if_addable();
+}
===================================================================
@@ -1,10 +0,0 @@
-// PR c++/58466
-// { dg-do compile { target c++11 } }
-
-template<char, char...> struct A;
-
-template<typename> struct B;
-
-template<char... C> struct B<A<C...>> {};
-
-B<A<'X'>> b; // { dg-error "incomplete type" }