commit f984ce6e04c376a9eb7a2a69706489f5aa330573
Author: Jason Merrill <jason@redhat.com>
Date: Mon Jan 16 14:19:32 2012 -0500
PR c++/51827
* mangle.c (mangle_decl): Don't mangle uninstantiated templates.
@@ -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
new file mode 100644
@@ -0,0 +1,3 @@
+// { dg-options -std=c++11 }
+
+#include "mangle1.Hs"
new file mode 100644
@@ -0,0 +1,8 @@
+// PR c++/51827
+// { dg-options "-flto -std=c++0x" }
+
+template<typename X> struct S { };
+template<typename Y> struct T {
+ template <typename ... A> T(S <A ...>);
+};
+inline void f(T<int>) { }