summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-11 13:38:34 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-11 13:38:34 +0000
commit22b930cb1e8c2210adaead83653ebc03fa8017b0 (patch)
tree6feb4846b99ecceebc5816e9ebd3ee18779de325
parent4d963951ba137f77124146c26bcd70240fdb0e7b (diff)
downloadgcc-22b930cb1e8c2210adaead83653ebc03fa8017b0.tar.gz
* mangle.c (decl_is_template_id): The template itself counts as a
template-id. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234879 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/mangle.c9
-rw-r--r--gcc/testsuite/g++.dg/abi/abi-tag20.C15
3 files changed, 25 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1a690a9bc5b..d1f1851d576 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2016-04-11 Jason Merrill <jason@redhat.com>
+
+ * mangle.c (decl_is_template_id): The template itself counts as a
+ template-id.
+
2016-04-08 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/70590
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 5d38373765b..0e444097c19 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -264,9 +264,9 @@ static void write_java_integer_type_codes (const tree);
#define write_unsigned_number(NUMBER) \
write_number ((NUMBER), /*unsigned_p=*/1, 10)
-/* If DECL is a template instance, return nonzero and, if
- TEMPLATE_INFO is non-NULL, set *TEMPLATE_INFO to its template info.
- Otherwise return zero. */
+/* If DECL is a template instance (including the uninstantiated template
+ itself), return nonzero and, if TEMPLATE_INFO is non-NULL, set
+ *TEMPLATE_INFO to its template info. Otherwise return zero. */
static int
decl_is_template_id (const tree decl, tree* const template_info)
@@ -290,7 +290,8 @@ decl_is_template_id (const tree decl, tree* const template_info)
{
/* Check if this is a primary template. */
if (DECL_LANG_SPECIFIC (decl) != NULL
- && DECL_USE_TEMPLATE (decl)
+ && VAR_OR_FUNCTION_DECL_P (decl)
+ && DECL_TEMPLATE_INFO (decl)
&& PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl))
&& TREE_CODE (decl) != TEMPLATE_DECL)
{
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag20.C b/gcc/testsuite/g++.dg/abi/abi-tag20.C
new file mode 100644
index 00000000000..229c1709be5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag20.C
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++11 } }
+// { dg-final { scan-assembler "_ZN1B1gIcEEN7__cxx111XEv" } }
+
+inline namespace __cxx11 __attribute__((__abi_tag__ ("ABI_TAG"))) {
+ class X {};
+}
+struct B {
+ X f();
+ template <class U> X g();
+};
+int main() {
+ B b;
+ b.g<char>();
+ return 0;
+}