https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71365
Bug ID: 71365 Summary: [7 Regression] g++ reject access to parent's parent virtual method Product: gcc Version: 7.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Created attachment 38615 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38615&action=edit testcase (from openttd) Compiler output: $ g++ accept.C accept.C: In member function 'virtual void C<T>::foo()': accept.C:7:55: error: 'A' is not a base of 'C<T>' class C : public B<T> { virtual void foo() { this->A::foo(); } }; ^~~ I think this code is valid, and it is accepted by all GCC versions up to 6.1.1. If it is invalid, the error message should be improved to mention, for example, "direct base". Note the code is accepted if B is not a template.