From 1ffe7b6ed2dceb878c8f35c9bc3560eaf01b5cf8 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sun, 29 Jun 2008 21:44:57 +0000 Subject: re PR c++/36655 (unjustified warning for "extern template" when using -pedantic -std=c++0x) /cp 2008-06-29 Paolo Carlini PR c++/36655 * pt.c (do_type_instantiation): In c++0x mode do not warn for extern template. /testsuite 2008-06-29 Paolo Carlini PR c++/36655 * g++.dg/cpp0x/extern_template-2.C: New. * g++.dg/cpp0x/extern_template.C: Rename to... * g++.dg/cpp0x/extern_template-1.C: ... this. From-SVN: r137261 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 13 +++++++++++-- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/cpp0x/extern_template-1.C | 4 ++++ gcc/testsuite/g++.dg/cpp0x/extern_template-2.C | 4 ++++ gcc/testsuite/g++.dg/cpp0x/extern_template.C | 4 ---- 6 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/extern_template-1.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/extern_template-2.C delete mode 100644 gcc/testsuite/g++.dg/cpp0x/extern_template.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5011770..5897d1b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-06-29 Paolo Carlini + + PR c++/36655 + * pt.c (do_type_instantiation): In c++0x mode do not warn for + extern template. + 2008-06-29 Kaveh R. Ghazi * Make-lang.in (cp-warn): Delete $(CXX_COMPAT_WARN). diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3222270..f24b6ff 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14676,8 +14676,17 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain) if (storage != NULL_TREE) { if (pedantic && !in_system_header) - pedwarn("ISO C++ forbids the use of %qE on explicit instantiations", - storage); + { + if (storage == ridpointers[(int) RID_EXTERN]) + { + if (cxx_dialect == cxx98) + pedwarn("ISO C++ 1998 forbids the use of % on " + "explicit instantiations"); + } + else + pedwarn("ISO C++ forbids the use of %qE on explicit " + "instantiations", storage); + } if (storage == ridpointers[(int) RID_INLINE]) nomem_p = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f2fbbb0..e1c86ae 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2008-06-29 Paolo Carlini + + PR c++/36655 + * g++.dg/cpp0x/extern_template-2.C: New. + * g++.dg/cpp0x/extern_template.C: Rename to... + * g++.dg/cpp0x/extern_template-1.C: ... this. + 2008-06-29 Thomas Koenig PR fortran/36341 diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-1.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-1.C new file mode 100644 index 0000000..ec2cb78 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-1.C @@ -0,0 +1,4 @@ +// { dg-options "-std=c++0x -pedantic" } + +template void f() {} +extern template void f(); diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-2.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-2.C new file mode 100644 index 0000000..89a9ceb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-2.C @@ -0,0 +1,4 @@ +// { dg-options "-std=c++0x -pedantic" } + +template class S {}; +extern template class S; diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template.C b/gcc/testsuite/g++.dg/cpp0x/extern_template.C deleted file mode 100644 index ec2cb78..0000000 --- a/gcc/testsuite/g++.dg/cpp0x/extern_template.C +++ /dev/null @@ -1,4 +0,0 @@ -// { dg-options "-std=c++0x -pedantic" } - -template void f() {} -extern template void f(); -- cgit v1.1