https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117993
Bug ID: 117993 Summary: inherited variables and functions not found in nested class Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: conradsand.arma at gmail dot com Target Milestone: --- Created attachment 59831 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59831&action=edit short program with templated and nested classes Using the attached program, GCC 15 20241208 complains with: gcc15bug.cpp: In member function ‘void B<T>::C<n>::bar()’: gcc15bug.cpp:23:13: error: ‘struct B<T>::C<n>’ has no member named ‘foo’ [-Wtemplate-body] 23 | (*this).foo(); | ^~~ gcc15bug.cpp:24:13: error: ‘struct B<T>::C<n>’ has no member named ‘x’ [-Wtemplate-body] 24 | (*this).x = T(3); Class C inherits the member function foo() and variable x from class A via class B, so this should work. GCC 14.2 and clang 18.1.8 (both from Fedora 40) compile this program without problems, suggesting this is a regression in GCC 15.