summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0362-PR-c-47049.patch
blob: 83e52a6cb0262f82c264734dc4fdda3e48a02869 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From 6d713af63560a2a98ee2e13d52eb339b57387bc7 Mon Sep 17 00:00:00 2001
From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat, 28 May 2011 03:22:31 +0000
Subject: [PATCH] 	PR c++/47049
 	* semantics.c (maybe_add_lambda_conv_op): Fix COMDAT sharing.
 	* decl.c (start_preparsed_function): Don't call comdat_linkage for
 	a template.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174377 138bc75d-0d04-0410-961f-82ee72b054a4

index 8395b2b..7e20009 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12425,6 +12425,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
 	DECL_EXTERNAL (decl1) = 0;
 
       if (ctx != NULL_TREE && DECL_DECLARED_INLINE_P (ctx)
+	  && !processing_template_decl
 	  && TREE_PUBLIC (ctx))
 	/* This is a function in a local class in an extern inline
 	   function.  */
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index b113626..cfd6cf0 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -8518,7 +8518,7 @@ maybe_add_lambda_conv_op (tree type)
     {
       /* Put the thunk in the same comdat group as the call op.  */
       struct cgraph_node *callop_node, *thunk_node;
-      DECL_COMDAT_GROUP (statfn) = DECL_COMDAT_GROUP (callop);
+      DECL_COMDAT_GROUP (statfn) = cxx_comdat_group (callop);
       callop_node = cgraph_node (callop);
       thunk_node = cgraph_node (statfn);
       gcc_assert (callop_node->same_comdat_group == NULL);
new file mode 100644
index 0000000..12ffde7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C
@@ -0,0 +1,20 @@
+// PR c++/47049
+// { dg-options -std=c++0x }
+
+enum { E = 0, F = 1 };
+template <int N, int M = ((N == 1) ? F : E)> class S {};
+template <int N>
+struct T
+{
+  static void
+  foo (S<N> *p)
+  {
+    S<N> u;
+    [&u] ()->bool {} ();
+  }
+};
+
+int main()
+{
+  T<0>().foo(0);
+}
-- 
1.7.0.4