diff options
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/error25.C | 16 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/spec35.C | 29 |
3 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7550286..dbfb12b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-06-18 Simon Baldwin <simonb@google.com> + + PR c++/31923 + * g++.dg/template/error25.C: New. + * g++.dg/template/spec35.C: New. + 2007-06-18 Kenneth Zadeck <zadeck@naturalbridge.com> * gcc.c-torture/compile/pr32355.c: New testcase. diff --git a/gcc/testsuite/g++.dg/template/error25.C b/gcc/testsuite/g++.dg/template/error25.C new file mode 100644 index 0000000..8901157 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/error25.C @@ -0,0 +1,16 @@ +// PR c++/31923 + +template<class T> +static void f1 (); + +template<> +static void f1<void> (); // { dg-error "explicit template specialization cannot have a storage class" } + +template<class T> +extern void f2 (); + +template<> +extern void f2<void> (); // { dg-error "explicit template specialization cannot have a storage class" } + +export template<class T> // { dg-warning "keyword 'export' not implemented" } +static void* f3 (); diff --git a/gcc/testsuite/g++.dg/template/spec35.C b/gcc/testsuite/g++.dg/template/spec35.C new file mode 100644 index 0000000..801b744 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/spec35.C @@ -0,0 +1,29 @@ +// PR c++/31923 +// C++ DR 605 -- "...the linkage of an explicit specialization must be that of +// the template." + +// { dg-require-weak "" } +// { dg-do compile { target i?86-*-* x86_64-*-* } } + +template<class T> +static void f1 (T) { } + +// { dg-final { scan-assembler-not ".glob(a|)l\[\t \]*_Z2f1IfEvT_" } } +template<> +void f1<float> (float) { } // Expected to have static linkage + +template<class T> +void f2 (T) { } + +// { dg-final { scan-assembler ".glob(a|)l\[\t \]*_Z2f2IfEvT_" } } +template<> +void f2<float> (float) { } // Expected to have global linkage + +void instantiator () +{ + // { dg-final { scan-assembler-not ".glob(a|)l\[\t \]*_Z2f1IiEvT_" } } + f1(0); // Expected to have static linkage + + // { dg-final { scan-assembler ".weak\[\t \]*_Z2f2IiEvT_" } } + f2(0); // Expected to have weak global linkage +} |