https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126987
Bug ID: 126987
Summary: GCC behaves different depending upon if conversion
function is explicitly called
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jlame646 at gmail dot com
Target Milestone: ---
GCC rejects #1 but accepts #2. [Demo](https://godbolt.org/z/WqKzxfWcv)
```
struct S {
template<typename T>
constexpr operator T()
{
return 10;
}
constexpr operator int()const
{
return 4;
}
};
int main()
{
S s;
// static_assert( s==4); //#1 MSVC OK, Clang No and GCC No
static_assert(s.operator int() ==4); //#2 MSVC OK, Clang No but GCC OK
}
```
I think the correct behavior would be to behave in the same way for both #1 and
#2.