https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113523
Bug ID: 113523
Summary: A conversion function template can have a deduced
return type
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
Contrary to https://timsong-cpp.github.io/cppwp/n4861/class.conv.fct#6, GCC
allows a conversion function template with a deduced return type:
struct A {
template<class=void>
constexpr operator auto() const { return 1; }
};
constexpr int f() {
return A{}.template operator auto();
}
static_assert( f() == 1 );
Online demo: https://godbolt.org/z/s8oK6rnPY
In addition, the diagnostics "warning: use of 'auto' in member template
conversion operator can never be deduced" seems wrong.