aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-01-16 16:32:05 -0500
committerJason Merrill <jason@gcc.gnu.org>2012-01-16 16:32:05 -0500
commita7cd72be0248ce0b24f61c603a3fc68fcb78baf3 (patch)
treeca32a02696a752d09e2b8ac2e4b3638ad648015d /gcc/cp
parentd836651c85e71e0a82540cf851943965966b568e (diff)
downloadgcc-a7cd72be0248ce0b24f61c603a3fc68fcb78baf3.zip
gcc-a7cd72be0248ce0b24f61c603a3fc68fcb78baf3.tar.gz
gcc-a7cd72be0248ce0b24f61c603a3fc68fcb78baf3.tar.bz2
re PR c++/51827 (Error: 'FOO' conflicts with a previous declaration, with PCH/LTO/C++11)
PR c++/51827 * mangle.c (mangle_decl): Don't mangle uninstantiated templates. From-SVN: r183221
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/mangle.c16
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a5a07e4..e3ef5f2e8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2012-01-16 Jason Merrill <jason@redhat.com>
+ PR c++/51827
+ * mangle.c (mangle_decl): Don't mangle uninstantiated templates.
+
PR c++/51868
* typeck.c (build_static_cast_1): Handle bit-fields properly.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 5f2fa15..15b1aca 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3330,7 +3330,21 @@ get_mangled_id (tree decl)
void
mangle_decl (const tree decl)
{
- tree id = get_mangled_id (decl);
+ tree id;
+ bool dep;
+
+ /* Don't bother mangling uninstantiated templates. */
+ ++processing_template_decl;
+ if (TREE_CODE (decl) == TYPE_DECL)
+ dep = dependent_type_p (TREE_TYPE (decl));
+ else
+ dep = (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)
+ && any_dependent_template_arguments_p (DECL_TI_ARGS (decl)));
+ --processing_template_decl;
+ if (dep)
+ return;
+
+ id = get_mangled_id (decl);
SET_DECL_ASSEMBLER_NAME (decl, id);
if (G.need_abi_warning