diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0362-PR-c-47049.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0362-PR-c-47049.patch | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0362-PR-c-47049.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0362-PR-c-47049.patch new file mode 100644 index 0000000000..83e52a6cb0 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0362-PR-c-47049.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From 6d713af63560a2a98ee2e13d52eb339b57387bc7 Mon Sep 17 00:00:00 2001 | ||
2 | From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Sat, 28 May 2011 03:22:31 +0000 | ||
4 | Subject: [PATCH] PR c++/47049 | ||
5 | * semantics.c (maybe_add_lambda_conv_op): Fix COMDAT sharing. | ||
6 | * decl.c (start_preparsed_function): Don't call comdat_linkage for | ||
7 | a template. | ||
8 | |||
9 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174377 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
10 | |||
11 | index 8395b2b..7e20009 100644 | ||
12 | --- a/gcc/cp/decl.c | ||
13 | +++ b/gcc/cp/decl.c | ||
14 | @@ -12425,6 +12425,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) | ||
15 | DECL_EXTERNAL (decl1) = 0; | ||
16 | |||
17 | if (ctx != NULL_TREE && DECL_DECLARED_INLINE_P (ctx) | ||
18 | + && !processing_template_decl | ||
19 | && TREE_PUBLIC (ctx)) | ||
20 | /* This is a function in a local class in an extern inline | ||
21 | function. */ | ||
22 | diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c | ||
23 | index b113626..cfd6cf0 100644 | ||
24 | --- a/gcc/cp/semantics.c | ||
25 | +++ b/gcc/cp/semantics.c | ||
26 | @@ -8518,7 +8518,7 @@ maybe_add_lambda_conv_op (tree type) | ||
27 | { | ||
28 | /* Put the thunk in the same comdat group as the call op. */ | ||
29 | struct cgraph_node *callop_node, *thunk_node; | ||
30 | - DECL_COMDAT_GROUP (statfn) = DECL_COMDAT_GROUP (callop); | ||
31 | + DECL_COMDAT_GROUP (statfn) = cxx_comdat_group (callop); | ||
32 | callop_node = cgraph_node (callop); | ||
33 | thunk_node = cgraph_node (statfn); | ||
34 | gcc_assert (callop_node->same_comdat_group == NULL); | ||
35 | new file mode 100644 | ||
36 | index 0000000..12ffde7 | ||
37 | --- /dev/null | ||
38 | +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C | ||
39 | @@ -0,0 +1,20 @@ | ||
40 | +// PR c++/47049 | ||
41 | +// { dg-options -std=c++0x } | ||
42 | + | ||
43 | +enum { E = 0, F = 1 }; | ||
44 | +template <int N, int M = ((N == 1) ? F : E)> class S {}; | ||
45 | +template <int N> | ||
46 | +struct T | ||
47 | +{ | ||
48 | + static void | ||
49 | + foo (S<N> *p) | ||
50 | + { | ||
51 | + S<N> u; | ||
52 | + [&u] ()->bool {} (); | ||
53 | + } | ||
54 | +}; | ||
55 | + | ||
56 | +int main() | ||
57 | +{ | ||
58 | + T<0>().foo(0); | ||
59 | +} | ||
60 | -- | ||
61 | 1.7.0.4 | ||
62 | |||