mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-28 06:14:10 +08:00
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:
parent
5be1c58c4d
commit
db8470f688
@ -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.
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
18
gcc/testsuite/g++.dg/template/access20.C
Normal file
18
gcc/testsuite/g++.dg/template/access20.C
Normal 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;
|
||||
}
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user