summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-15 01:53:23 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-15 01:53:23 +0000
commit3eeb07f7dbf1ceb4bb2bf44a3d62aa072b58f81b (patch)
tree18a8356e6c1d6ef2f5a6a68accfbd97f30d76a5b
parent791ad7658557613dc51679daea4cb65eeba15f55 (diff)
downloadgcc-3eeb07f7dbf1ceb4bb2bf44a3d62aa072b58f81b.tar.gz
PR c++/55275
* pt.c (maybe_process_partial_specialization): Update DECL_SOURCE_LOCATION for new specializations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193524 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/g++.dg/abi/abi-tag3.C36
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr31439.C4
-rw-r--r--gcc/testsuite/g++.dg/template/crash98.C4
-rw-r--r--libstdc++-v3/testsuite/ext/type_traits/add_unsigned_integer_neg.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_integer_neg.cc3
7 files changed, 52 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d382a04f895..bb5e4bad4a7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-11-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/55275
+ * pt.c (maybe_process_partial_specialization): Update
+ DECL_SOURCE_LOCATION for new specializations.
+
2012-11-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55323
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 802c79b8755..3c9bb56c66b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -838,6 +838,7 @@ maybe_process_partial_specialization (tree type)
{
check_specialization_namespace (CLASSTYPE_TI_TEMPLATE (type));
SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type);
+ DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)) = input_location;
if (processing_template_decl)
{
if (push_template_decl (TYPE_MAIN_DECL (type))
@@ -934,6 +935,7 @@ maybe_process_partial_specialization (tree type)
have one level of template argument for the innermost
class template. */
SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type);
+ DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)) = input_location;
CLASSTYPE_TI_ARGS (type)
= INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (type));
}
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag3.C b/gcc/testsuite/g++.dg/abi/abi-tag3.C
new file mode 100644
index 00000000000..05fd58e9402
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag3.C
@@ -0,0 +1,36 @@
+// An explicit specialization doesn't get the tag from its template unless
+// it is specified there, too.
+
+// { dg-final { scan-assembler "_ZN3FooB5cxx11IcE1fEv" } }
+template<typename T>
+struct __attribute ((abi_tag("cxx11"))) Foo
+{
+ int f();
+};
+
+// { dg-final { scan-assembler "_ZN3FooB5cxx11IiE1fEv" } }
+template<>
+struct
+__attribute ((abi_tag("cxx11")))
+Foo<int>
+{
+ int f();
+};
+
+// { dg-final { scan-assembler "_ZN3FooIdE1fEv" } }
+template<>
+struct
+Foo<double>
+{
+ int f();
+};
+
+int main()
+{
+ Foo<int> f;
+ f.f();
+ Foo<char> f1;
+ f1.f();
+ Foo<double> f2;
+ f2.f();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr31439.C b/gcc/testsuite/g++.dg/cpp0x/pr31439.C
index 9d22b56c2f8..c64bc3145b6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr31439.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr31439.C
@@ -1,7 +1,7 @@
// { dg-options "-std=c++0x" }
-template<typename...> struct A; // { dg-error "declaration" }
+template<typename...> struct A;
-template<char> struct A<> {}; // { dg-error "not used in partial specialization|anonymous" }
+template<char> struct A<> {}; // { dg-error "not used in partial specialization|anonymous|declaration" }
template<typename T, typename... U> struct A<T, U...> : A<U...> {}; // { dg-error "incomplete type" }
diff --git a/gcc/testsuite/g++.dg/template/crash98.C b/gcc/testsuite/g++.dg/template/crash98.C
index e3c224df1d9..a79ab02f695 100644
--- a/gcc/testsuite/g++.dg/template/crash98.C
+++ b/gcc/testsuite/g++.dg/template/crash98.C
@@ -1,8 +1,8 @@
// PR c++/43630
-template < typename > struct A; // { dg-error "declaration" }
+template < typename > struct A;
-template < typename > struct A < int > // { dg-error "not used|template\\-parameter" }
+template < typename > struct A < int > // { dg-error "not used|template\\-parameter|declaration" }
{
int i;
int f ();
diff --git a/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_integer_neg.cc b/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_integer_neg.cc
index b976de022b4..bdd27cc85e1 100644
--- a/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_integer_neg.cc
+++ b/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_integer_neg.cc
@@ -36,4 +36,5 @@ int main()
}
// { dg-error "invalid use of incomplete" "" { target *-*-* } 28 }
-// { dg-error "declaration of" "" { target *-*-* } 63 }
+// { dg-error "declaration of" "" { target *-*-* } 98 }
+// { dg-error "declaration of" "" { target *-*-* } 101 }
diff --git a/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_integer_neg.cc b/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_integer_neg.cc
index bd5c4237e02..099178ef1ce 100644
--- a/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_integer_neg.cc
+++ b/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_integer_neg.cc
@@ -36,4 +36,5 @@ int main()
}
// { dg-error "invalid use of incomplete" "" { target *-*-* } 28 }
-// { dg-error "declaration of" "" { target *-*-* } 106 }
+// { dg-error "declaration of" "" { target *-*-* } 141 }
+// { dg-error "declaration of" "" { target *-*-* } 144 }