aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-02-12 17:44:38 -0500
committerJason Merrill <jason@gcc.gnu.org>2015-02-12 17:44:38 -0500
commit3b95b65ced07d1540b713cb926468a1de87b8b49 (patch)
tree50d60a2ea2441ee521a2a077b1e41065fd83fdb0
parent8ae6ac51d45d07b87546a06a376ba5e75e1f4486 (diff)
downloadgcc-3b95b65ced07d1540b713cb926468a1de87b8b49.zip
gcc-3b95b65ced07d1540b713cb926468a1de87b8b49.tar.gz
gcc-3b95b65ced07d1540b713cb926468a1de87b8b49.tar.bz2
re PR c++/64898 (qtgui-4.8.6 build error)
PR c++/64898 * mangle.c (write_mangled_name): Fix test for variable template instantiation. From-SVN: r220666
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/mangle.c3
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle65.C13
3 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4f75646..f181554 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2015-02-12 Jason Merrill <jason@redhat.com>
+ PR c++/64898
+ * mangle.c (write_mangled_name): Fix test for variable template
+ instantiation.
+
* decl.c (begin_destructor_body): Condition clobber on
-flifetime-dse.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 45377fc..fbf4bf2 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -682,7 +682,8 @@ write_mangled_name (const tree decl, bool top_level)
}
else if (VAR_P (decl)
/* Variable template instantiations are mangled. */
- && !(DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl))
+ && !(DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)
+ && variable_template_p (DECL_TI_TEMPLATE (decl)))
/* The names of non-static global variables aren't mangled. */
&& DECL_EXTERNAL_LINKAGE_P (decl)
&& (CP_DECL_CONTEXT (decl) == global_namespace
diff --git a/gcc/testsuite/g++.dg/abi/mangle65.C b/gcc/testsuite/g++.dg/abi/mangle65.C
new file mode 100644
index 0000000..13169c2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle65.C
@@ -0,0 +1,13 @@
+// PR c++/64898
+// { dg-final { scan-assembler-not "_Z6foovar" } }
+
+template <class> void f()
+{
+ extern int foovar;
+ foovar = 42;
+}
+
+int main()
+{
+ f<int>();
+}