From a6d665993510a9f27dbd892b0e0808dc9e3b9e72 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 27 May 2011 20:53:58 -0400 Subject: [PATCH] mangle.c (mangle_decl_string): Make sure we don't try to mangle templates. * mangle.c (mangle_decl_string): Make sure we don't try to mangle templates. From-SVN: r174376 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/decl.c | 8 ++++---- gcc/cp/mangle.c | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3419d518ffb..269e0d1e60f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-05-27 Jason Merrill + * mangle.c (mangle_decl_string): Make sure we don't try to mangle + templates. + PR c++/47049 * semantics.c (maybe_add_lambda_conv_op): Fix COMDAT sharing. * decl.c (start_preparsed_function): Don't call comdat_linkage for diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 8fe32592c5f..232b5cf12f3 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12664,7 +12664,9 @@ start_preparsed_function (tree decl1, tree attrs, int flags) compiler-generated functions. */ && !DECL_ARTIFICIAL (decl1)); - if (DECL_INTERFACE_KNOWN (decl1)) + if (processing_template_decl) + /* Don't mess with interface flags. */; + else if (DECL_INTERFACE_KNOWN (decl1)) { tree ctx = decl_function_context (decl1); @@ -12672,7 +12674,6 @@ 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. */ @@ -12684,8 +12685,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) else if (!finfo->interface_unknown && honor_interface) { if (DECL_DECLARED_INLINE_P (decl1) - || DECL_TEMPLATE_INSTANTIATION (decl1) - || processing_template_decl) + || DECL_TEMPLATE_INSTANTIATION (decl1)) { DECL_EXTERNAL (decl1) = (finfo->interface_only diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 27ef374597e..7ecfefb3b80 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -3095,6 +3095,9 @@ mangle_decl_string (const tree decl) tree saved_fn = NULL_TREE; bool template_p = false; + /* We shouldn't be trying to mangle an uninstantiated template. */ + gcc_assert (!type_dependent_expression_p (decl)); + if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl)) { struct tinst_level *tl = current_instantiation (); -- 2.30.2