Commit 4fce678f by Jason Merrill Committed by Jason Merrill

re PR c++/55275 (abi_tag attribute doesn't work on explicit specializations of class templates)

	PR c++/55275
	* pt.c (maybe_process_partial_specialization): Update
	DECL_SOURCE_LOCATION for new specializations.

From-SVN: r193524
parent c25639b1
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> 2012-11-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55323 PR c++/55323
......
...@@ -838,6 +838,7 @@ maybe_process_partial_specialization (tree type) ...@@ -838,6 +838,7 @@ maybe_process_partial_specialization (tree type)
{ {
check_specialization_namespace (CLASSTYPE_TI_TEMPLATE (type)); check_specialization_namespace (CLASSTYPE_TI_TEMPLATE (type));
SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type); SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type);
DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)) = input_location;
if (processing_template_decl) if (processing_template_decl)
{ {
if (push_template_decl (TYPE_MAIN_DECL (type)) if (push_template_decl (TYPE_MAIN_DECL (type))
...@@ -934,6 +935,7 @@ maybe_process_partial_specialization (tree type) ...@@ -934,6 +935,7 @@ maybe_process_partial_specialization (tree type)
have one level of template argument for the innermost have one level of template argument for the innermost
class template. */ class template. */
SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type); SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type);
DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)) = input_location;
CLASSTYPE_TI_ARGS (type) CLASSTYPE_TI_ARGS (type)
= INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (type)); = INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (type));
} }
......
// 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();
}
// { dg-options "-std=c++0x" } // { 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" } template<typename T, typename... U> struct A<T, U...> : A<U...> {}; // { dg-error "incomplete type" }
......
// PR c++/43630 // 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 i;
int f (); int f ();
......
...@@ -36,4 +36,5 @@ int main() ...@@ -36,4 +36,5 @@ int main()
} }
// { dg-error "invalid use of incomplete" "" { target *-*-* } 28 } // { 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 }
...@@ -36,4 +36,5 @@ int main() ...@@ -36,4 +36,5 @@ int main()
} }
// { dg-error "invalid use of incomplete" "" { target *-*-* } 28 } // { 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 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment