-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nameless struct leads to deleted operator== with no diagnostics #92497
Comments
Definitely a bug. This related snippet: struct S {
struct {
bool b;
};
bool operator==(const S&) const noexcept;
};
bool S::operator==(const S&) const noexcept = default;
bool f(S const& a, S const& b) { return a == b; } is invalid but causes a crash https://godbolt.org/z/1Kj4s8axT
|
@llvm/issue-subscribers-clang-frontend Author: Tiago (tiagomacarios)
The following code:
https://godbolt.org/z/rM83Md9jT
```
struct S {
struct {
bool b;
};
}; bool f(S const& a, S const& b) { return a == b; } int main() {}
<source>:9:(.text+0x19): undefined reference to `S::operator==(S const&) const'
<source>:9:46: error: use of deleted function 'constexpr bool S::operator==(const S&) const'
|
Worth noting edg/MSVC accept, the original example: https://godbolt.org/z/GMv36vYKr CC @Endilll |
Ideally it seems like we should accept this, and compare the anonymous struct member elementwise. |
The following code:
https://godbolt.org/z/rM83Md9jT
Fails at link time with:
gcc diagnostics are much better and earlier (compile time):
Could we add the same warning as gcc?
The text was updated successfully, but these errors were encountered: