[Bug c++/38579] New: Template: Wrong inherited copy-ctor visibility
syntheticpp at gmx dot net
gcc-bugzilla@gcc.gnu.org
Fri Dec 19 13:01:00 GMT 2008
The code below compiles, but it should give an error, because the Policy ctor
is not accessible when inheriting protected from Policy
To have valid C++ code the inheritance must be public.
struct Policy
{
protected:
Policy() {}
Policy(const Policy&) {}
};
template<int I, class P>
struct BugGcc :
protected P
//public P
{
BugGcc() {}
template<int I, class P>
BugGcc(const BugGcc<I, P>& t) : P(t) {}
};
void foo()
{
BugGcc<0, Policy> f1;
BugGcc<1, Policy> f2(f1);
}
GCC:
gcc-Version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)
--
Summary: Template: Wrong inherited copy-ctor visibility
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: syntheticpp at gmx dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
More information about the Gcc-bugs
mailing list