Patchwork [C++] PR 58466

login
register
mail settings
Submitter Paolo Carlini
Date Oct. 31, 2013, 12:02 p.m.
Message ID <527246E3.5070508@oracle.com>
Download mbox | patch
Permalink /patch/287466/
State New
Headers show

Comments

Paolo Carlini - Oct. 31, 2013, 12:02 p.m.
... for now I'm reverting this commit. The issue is just an ICE on 
invalid and the fix is causing problems, per c++/58932 - sorry about that.

Thanks,
Paolo.

///////////////////////
/cp
2013-10-31  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58932
	Revert:
	2013-10-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58466
	* pt.c (most_specialized_class): Bump processing_template_decl for
	get_class_bindings.

/testsuite
2013-10-31  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58932
	Revert:
	2013-10-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58466
	* g++.dg/cpp0x/variadic145.C: New.

	* g++.dg/cpp0x/sfinae49.C: New.

Patch

Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 204249)
+++ cp/pt.c	(working copy)
@@ -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)
Index: testsuite/g++.dg/cpp0x/sfinae49.C
===================================================================
--- testsuite/g++.dg/cpp0x/sfinae49.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/sfinae49.C	(working copy)
@@ -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();
+}
Index: testsuite/g++.dg/cpp0x/variadic145.C
===================================================================
--- testsuite/g++.dg/cpp0x/variadic145.C	(revision 204249)
+++ testsuite/g++.dg/cpp0x/variadic145.C	(working copy)
@@ -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" }