[Bug c++/77368] New: Private static member visible to templated subclass
albin.olsson at volvocars dot com
gcc-bugzilla@gcc.gnu.org
Wed Aug 24 15:06:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77368
Bug ID: 77368
Summary: Private static member visible to templated subclass
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: albin.olsson at volvocars dot com
Target Milestone: ---
The following code is accepted by g++, but only if B is a templated class:
struct A
{
private:
static const int private_of_A = 5;
};
template <typename T>
struct B : public A
{
int get()
{
return private_of_A;
}
};
int main()
{
B<int> b;
return b.get();
}
This problem exists for all version of gcc I tested, which are:
x86-64 gcc 4.8.4
x86-64 gcc 6.2 (g++ ('Compiler) 6.2.0)
ARM64 gcc 4.8 (aarch64-linux-gnu-g++ (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.1)
5.4.0 20160609)
The two latter ones via https://gcc.godbolt.org/#
More information about the Gcc-bugs
mailing list