diff options
author | Jason Merrill <jason@redhat.com> | 2011-05-27 20:53:49 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-05-27 20:53:49 -0400 |
commit | 669baa1576a1b90def048584f64dbe7cca3f0b94 (patch) | |
tree | dfdaed167f5429070153b761d7375549c8bb6683 /gcc | |
parent | faa00511123f0b50467f6526d14f97f56716db94 (diff) | |
download | gcc-669baa1576a1b90def048584f64dbe7cca3f0b94.zip gcc-669baa1576a1b90def048584f64dbe7cca3f0b94.tar.gz gcc-669baa1576a1b90def048584f64dbe7cca3f0b94.tar.bz2 |
re PR c++/47049 ([C++0x] ICE in write_unnamed_type_name with lambda use)
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.
From-SVN: r174375
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 1 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C | 20 |
5 files changed, 31 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9ccdee5..3419d51 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2011-05-27 Jason Merrill <jason@redhat.com> + 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. + PR c++/47132 * mangle.c (write_expression): Handle MODOP_EXPR. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3cc25bd..8fe3259 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12672,6 +12672,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 557bf4c..854bac7 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -8578,7 +8578,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_get_create_node (callop); thunk_node = cgraph_get_create_node (statfn); gcc_assert (callop_node->same_comdat_group == NULL); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 915cd90..36edc22 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-05-27 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/lambda/lambda-template2.C: New. + 2011-05-27 Tobias Burnus <burnus@net-b.de> PR fortran/18918 diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C 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); +} |