Open tiagomacarios opened 4 months ago
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
<source>:11:41: error: cannot compile this scalar expression yet
11 | bool f(S const& a, S const& b) { return a == b; }
| ^~~~~~
Unexpected placeholder builtin type!
UNREACHABLE executed at /root/llvm-project/clang/lib/CodeGen/CodeGenTypes.cpp:542!
@llvm/issue-subscribers-clang-frontend
Author: Tiago (tiagomacarios)
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?