re PR c++/29470 (Using declaration access semantics change with templates)

PR c++/29470
        * pt.c (tsubst_decl) [USING_DECL]: Propagate access flags.

From-SVN: r143445
This commit is contained in:
Jason Merrill 2009-01-16 17:36:11 -05:00 committed by Jason Merrill
parent 5be1c58c4d
commit db8470f688
5 changed files with 33 additions and 0 deletions

View 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.

View 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
{

View 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

View File

@ -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;
}

View 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;
};