re PR c++/39987 (Rejects default argument that is a template via access failure)
authorDodji Seketeli <dodji@redhat.com>
Tue, 4 Aug 2009 19:49:48 +0000 (19:49 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Tue, 4 Aug 2009 19:49:48 +0000 (21:49 +0200)
2009-08-04  Dodji Seketeli  <dodji@redhat.com>

gcc/cp/ChangeLog:
PR c++/39987
* pt.c (tsubst_default_argument): Let access checks of the
default argument happen in the context of the current function.

gcc/testsuite/ChangeLog:
PR c++/39987
* g++.dg/overload/defarg4.C: New test.

From-SVN: r150467

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog

index 71fed72eb921f14bdacd90d20ae012541afe9062..970b6dc5152404c829120d9d2be29a75982ae22a 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-04  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/39987
+       * pt.c (tsubst_default_argument): Let access checks of the
+       default argument happen in the context of the current function.
+
 2009-08-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR c++/16696
index ed45324b9ab6a905b2e7cb96eef0bb8f3cdc3fc1..c0c61c5a4262a12c32aa7a9067144b10573f140e 100644 (file)
@@ -8253,11 +8253,11 @@ tsubst_default_argument (tree fn, tree type, tree arg)
       cp_function_chain->x_current_class_ref = saved_class_ref;
     }
 
-  pop_access_scope (fn);
-
   /* Make sure the default argument is reasonable.  */
   arg = check_default_argument (type, arg);
 
+  pop_access_scope (fn);
+
   return arg;
 }
 
index cecd2a13ba0b1a744d3dff595e6c580fba986296..0d4378cfc0ab2a863658863e995fdc2d283cbf1b 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-04  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/39987
+       * g++.dg/overload/defarg4.C: New test.
+
 2009-08-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR c++/16696