[PATCH] Fix PR c++/59635

Adam Butcher adam@jessamine.co.uk
Sat Jan 4 08:58:00 GMT 2014


	* cp/lambda.c (maybe_add_lambda_conv_op): Handle marking conversion
	function as unimplemented for generic lambdas with varargs.

	* g++.dg/opt/pr59635.C: New testcase.
---
 gcc/cp/lambda.c                      | 2 +-
 gcc/testsuite/g++.dg/cpp1y/pr59635.C | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr59635.C

diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 1855716..8bb820d 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -970,7 +970,7 @@ maybe_add_lambda_conv_op (tree type)
      the conversion op is used.  */
   if (varargs_function_p (callop))
     {
-      DECL_DELETED_FN (fn) = 1;
+      DECL_DELETED_FN (STRIP_TEMPLATE (fn)) = 1;
       return;
     }
 
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr59635.C b/gcc/testsuite/g++.dg/cpp1y/pr59635.C
new file mode 100644
index 0000000..07bd6c4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr59635.C
@@ -0,0 +1,9 @@
+// { dg-do compile }
+// { dg-options "-std=c++1y" }
+
+// PR c++/59635
+
+auto f = [] (auto, ...) { return 0; };
+
+int (*p) (int, ...) = f;  // { dg-error "unimplemented" }
+
-- 
1.8.5.2



More information about the Gcc-patches mailing list