re PR c++/53821 ([c++11] multiple definitions of lambda)
authorJason Merrill <jason@redhat.com>
Mon, 2 Jul 2012 19:14:34 +0000 (15:14 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 2 Jul 2012 19:14:34 +0000 (15:14 -0400)
PR c++/53821
* semantics.c (maybe_add_lambda_conv_op): Don't set
DECL_INTERFACE_KNOWN.

From-SVN: r189175

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template6.C [new file with mode: 0644]

index 448dd5caa8ec04ecfe6d9e6d84e53f14aac66212..fb8a34de04c92dc88528507a42738b8f2902d51a 100644 (file)
@@ -1,5 +1,9 @@
 2012-07-02  Jason Merrill  <jason@redhat.com>
 
+       PR c++/53821
+       * semantics.c (maybe_add_lambda_conv_op): Don't set
+       DECL_INTERFACE_KNOWN.
+
        PR c++/53524
        * call.c (build_conditional_expr_1): Don't warn about comparison of
        two enumerators before their enumeration is complete.
index f1a94c118725de71f4a1ab643fce75966582ebb2..8e37ebb7e162eda1e954ef6c92c9e4da41baffe0 100644 (file)
@@ -9336,8 +9336,6 @@ maybe_add_lambda_conv_op (tree type)
   DECL_NOT_REALLY_EXTERN (fn) = 1;
   DECL_DECLARED_INLINE_P (fn) = 1;
   DECL_ARGUMENTS (fn) = build_this_parm (fntype, TYPE_QUAL_CONST);
-  if (nested)
-    DECL_INTERFACE_KNOWN (fn) = 1;
 
   add_method (type, fn, NULL_TREE);
 
@@ -9368,8 +9366,6 @@ maybe_add_lambda_conv_op (tree type)
   DECL_ARGUMENTS (fn) = copy_list (DECL_CHAIN (DECL_ARGUMENTS (callop)));
   for (arg = DECL_ARGUMENTS (fn); arg; arg = DECL_CHAIN (arg))
     DECL_CONTEXT (arg) = fn;
-  if (nested)
-    DECL_INTERFACE_KNOWN (fn) = 1;
 
   add_method (type, fn, NULL_TREE);
 
index 5d5a2ce4cf81babfc8693b66659184d0e62827d0..b62e76f0b4f89798cf9971446f7d967fd860ea40 100644 (file)
@@ -1,5 +1,8 @@
 2012-07-02  Jason Merrill  <jason@redhat.com>
 
+       PR c++/53821
+       * g++.dg/cpp0x/lambda/lambda-template6.C: New.
+
        PR c++/53524
        * g++.dg/template/enum7.C: New.
        * g++.dg/other/ptrmem10.C: Adjust.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template6.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template6.C
new file mode 100644 (file)
index 0000000..5e85619
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/53821
+// { dg-final { scan-assembler-not "_ZZ1fIvEvvENKUlvE_cvPFvvEEv" } }
+// { dg-do compile { target c++11 } }
+
+template <class T> void f()
+{
+  auto g = []{};
+  g();
+}
+
+int main()
+{
+  f<void>();
+}