]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/29470 (Using declaration access semantics change with templates)
authorJason Merrill <jason@redhat.com>
Fri, 16 Jan 2009 22:36:11 +0000 (17:36 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 16 Jan 2009 22:36:11 +0000 (17:36 -0500)
        PR c++/29470
        * pt.c (tsubst_decl) [USING_DECL]: Propagate access flags.

From-SVN: r143445

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 395873ced6b96929fcafc0fe62665435b9d1f23c..ff0de59009964ad953afed2f69d776305ef4a30b 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 0378d39be123fbf6262536601d0fef0e5554cbd0..f6809f2bdf7db53d78b412e66acde646c8f4042a 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 a7084b7e850717770f56d25da76509c720f83f19..69660e789e6a5d71b94fe1dd9841b1dd790aeb6e 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 9e4f2662e7845d51fd2ad07117e97cd00ceef4c1..0cf507762811a611ba22f905a42259e170ff6c42 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;
 };