[Bug c++/94056] New: Bogus "private within this context" error is emitted after too-late template specialization
drahflow at gmx dot de
gcc-bugzilla@gcc.gnu.org
Thu Mar 5 15:38:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94056
Bug ID: 94056
Summary: Bogus "private within this context" error is emitted
after too-late template specialization
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: drahflow at gmx dot de
Target Milestone: ---
class outer {
class inner {
template<class T> void f();
};
};
template<> void outer::inner::f<int>() {
f<void>();
}
template<> void outer::inner::f<void>() {
}
int main(void) {
return 0;
}
gives
wrong-error.c++:11:39: error: specialization of ‘void outer::inner::f() [with T
= void]’ after instantiation
11 | template<> void outer::inner::f<void>() {
| ^
wrong-error.c++:11:17: error: ‘class outer::inner’ is private within this
context
11 | template<> void outer::inner::f<void>() {
| ^~~~~
wrong-error.c++:2:9: note: declared private here
2 | class inner {
However, the privateness of inner is entirely irrelevant to the problem.
This error is reproducible for all g++ versions I tested (4.8 - 10).
More information about the Gcc-bugs
mailing list