[Bug c++/103110] New: templated operator auto is ignored
fchelnokov at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Nov 6 19:27:57 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103110
Bug ID: 103110
Summary: templated operator auto is ignored
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
This code should be valid:
```
struct S {
template<class=void>
operator auto() const { return 2; }
};
int main() {
S s;
[[maybe_unused]] int d = s;
}
```
and Clang accepts it, while GCC does not. Demo:
https://gcc.godbolt.org/z/rMK4zboEd
More information about the Gcc-bugs
mailing list