Open Quuxplusone opened 7 years ago
Bugzilla Link | PR34907 |
Status | NEW |
Importance | P enhancement |
Reported by | Ryan Prichard (rprichard@google.com) |
Reported on | 2017-10-10 14:10:14 -0700 |
Last modified on | 2021-01-26 06:24:43 -0800 |
Version | 5.0 |
Hardware | PC Linux |
CC | antoshkka@gmail.com, eric@efcs.ca, ki.stfu@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk, rjmccall@apple.com, smeenai@fb.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Simple example showing another manifestation of this:
$ cat a.cpp
namespace {
struct S {};
} // namespace
void f() { throw S(); }
$ cat b.cpp
namespace {
struct S {};
} // namespace
void f();
int main() {
try {
f();
} catch (S &) {
}
}
$ g++ a.cpp b.cpp
$ ./a.out
terminate called after throwing an instance of '(anonymous namespace)::S'
[1] 3562076 abort (core dumped) ./a.out
$ clang++ a.cpp b.cpp
$ ./a.out # exits successfully
libc++ gained the ability to perform string equality-based typeinfo comparisons
in https://reviews.llvm.org/rL361913, but those don't take the leading asterisk
into account either.
I guess Clang would have to generate different code for -stdlib=libstdc++ and -stdlib=libc++?
The difference is by target platform, not by target standard library. Darwin generally uses the strict Itanium ABI rule, but on arm64 it tweaks it as you observe. GCC decided years ago to diverge from the official Itanium rule in a few ways, and I think this is just another aspect of that divergence. Since GCC defines the ABI for Linux, both Clang and libc++ need to use GCC's modified rule on Linux and probably several other targets.