https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104575
Bug ID: 104575
Summary: noexcept operator rejects call to templated base class
member function
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: oliver.rosten at googlemail dot com
Target Milestone: ---
struct Y
{
void swap(Y& rhs) noexcept {}
};
template<class B>
struct D : B
{
void swap(D& rhs) noexcept (noexcept(B::swap(rhs))) {}
};
struct E : Y
{
void swap(E& rhs) noexcept (noexcept(Y::swap(rhs))) {}
};
void foo()
{
D<Y> x{}, y{};
x.swap(y); // Rejected
E u{}, v{};
u.swap(v); // OK
}
-----------
error: cannot call member function 'void Y::swap(Y&)' without object
https://godbolt.org/z/E3P9MEd6z