re PR c++/36655 (unjustified warning for "extern template" when using -pedantic ...
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 29 Jun 2008 21:44:57 +0000 (21:44 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 29 Jun 2008 21:44:57 +0000 (21:44 +0000)
/cp
2008-06-29  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/36655
* pt.c (do_type_instantiation): In c++0x mode do not warn for
extern template.

/testsuite
2008-06-29  Paolo Carlini  <paolo.carlini@oracle.com>

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
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/extern_template-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/extern_template-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/extern_template.C [deleted file]

index 50117700c4148da5ef5ac961732387c29a54cd32..5897d1b5a7411f9f17520d62b780ab52c8114444 100644 (file)
@@ -1,3 +1,9 @@
+2008-06-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/36655
+       * pt.c (do_type_instantiation): In c++0x mode do not warn for
+       extern template.
+
 2008-06-29  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Make-lang.in (cp-warn): Delete $(CXX_COMPAT_WARN).
index 32222705f8e8299f4d6a5100ae2c6f6f805b56c3..f24b6ff04b30e17ad3e29bcac4567b9d34080610 100644 (file)
@@ -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 %<extern%> 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;
index f2fbbb0f95c87034518a6f7acb0c322bfa35e7db..e1c86aeff2d8a6eabfb79e478dbbbc998e84579a 100644 (file)
@@ -1,3 +1,10 @@
+2008-06-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       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  <tkoenig@gcc.gnu.org>
 
        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 (file)
index 0000000..ec2cb78
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-options "-std=c++0x -pedantic" }
+
+template <typename> void f() {}
+extern template void f<int>();
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 (file)
index 0000000..89a9ceb
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-options "-std=c++0x -pedantic" }
+
+template <typename> class S {};
+extern template class S<int>;
diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template.C b/gcc/testsuite/g++.dg/cpp0x/extern_template.C
deleted file mode 100644 (file)
index ec2cb78..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// { dg-options "-std=c++0x -pedantic" }
-
-template <typename> void f() {}
-extern template void f<int>();