https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91141
Bug ID: 91141 Summary: Can't use class members inside conditional noexcept specifier Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: brickmen75 at gmail dot com Target Milestone: --- There is minimal example of code that deny to compile: -------------------- template <class T> class widget { public: void swap(widget& rhs) noexcept(noexcept(std::swap(t, rhs.t))) { std::swap(t, rhs.t); } private: T t; }; int main() { widget<int> w1, w2; w1.swap(w2); } -------------------- Seems like gcc forbids use of class members inside conditional noexcept specifier. Simple workaround is to use this-> along with class members. Also godbolt example: https://godbolt.org/z/dz18YQ