https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94944
Bug ID: 94944 Summary: compile error accessing member function of dependent base class template in exception specification Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eracpp at eml dot cc Target Milestone: --- GCC fails to compile a qualified invocation of a member function of a dependent base class template when used within an exception specification: ---- template <typename T> struct B { void foo(T t) {} }; template <typename T> struct D : B<T> { void foo(T t) noexcept(noexcept(B<T>::foo(t))) {} }; template struct D<int>; ---- The error message is as follows: ---- error: cannot call member function 'void B<T>::foo(T) [with T = int]' without object 8 | void foo(T t) noexcept(noexcept(B<T>::foo(t))) {} | ---- Clang and MSVC accept the code as given without error: https://gcc.godbolt.org/z/MW2iQz Note, a workaround accepted by all three major compilers is to qualify the invocation with `this->`: ---- void foo(T t) noexcept(noexcept(this->B<T>::foo(t))) {} ----