OSDN Git Service

PR c++/29470
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Jan 2009 22:36:11 +0000 (22:36 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Jan 2009 22:36:11 +0000 (22:36 +0000)
        * pt.c (tsubst_decl) [USING_DECL]: Propagate access flags.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143445 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/access20.C [new file with mode: 0644]
gcc/testsuite/g++.dg/torture/pr34641.C

index 395873c..ff0de59 100644 (file)
@@ -1,5 +1,8 @@
 2009-01-16  Jason Merrill  <jason@redhat.com>
 
+       PR c++/29470
+       * pt.c (tsubst_decl) [USING_DECL]: Propagate access flags.
+
        PR c++/38579
        * search.c (protected_accessible_p): N doesn't vary.
 
index 0378d39..f6809f2 100644 (file)
@@ -8485,6 +8485,11 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
             tsubst_copy (DECL_NAME (t), args, complain, in_decl));
          if (!r)
            r = error_mark_node;
+         else
+           {
+             TREE_PROTECTED (r) = TREE_PROTECTED (t);
+             TREE_PRIVATE (r) = TREE_PRIVATE (t);
+           }
        }
       else
        {
index a7084b7..69660e7 100644 (file)
@@ -1,3 +1,9 @@
+2009-01-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/29470
+       * g++.dg/template/access20.C: New test.
+       * g++.dg/torture/pr34641.C: Fix access.
+
 2009-01-16  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/38835
diff --git a/gcc/testsuite/g++.dg/template/access20.C b/gcc/testsuite/g++.dg/template/access20.C
new file mode 100644 (file)
index 0000000..ebf575e
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/29470
+
+template <typename T> struct B
+{
+        protected:
+        T v;                   // { dg-error "protected" }
+};
+template <typename T> struct D : B<T>
+{
+        protected:
+        using B<T>::v;
+};
+int main()
+{
+        D<int> d;
+        d.v = 0;               // { dg-error "context" }
+        return 0;
+}
index 9e4f266..0cf5077 100644 (file)
@@ -70,6 +70,7 @@ template < typename T, size_t inlineCapacity > class VectorBuffer;
 template < typename T > class VectorBuffer < T, 0 >:private VectorBufferBase <
   T >
 {
+public:
   typedef VectorBufferBase < T > Base;
   using Base::allocateBuffer;
 };