<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/92121>92121</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Unable to catch exceptions with clang++ 18.1.5 on macos ARM (try-catch does nothing)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
themightyoarfish
</td>
</tr>
</table>
<pre>
# System Info
- OS: macos 12.6.5
- arch: Apple silicon
# Compiler info
- Homebrew clang version 18.1.5
- Target: arm64-apple-darwin21.6.0
- Thread model: posix
- InstalledDir: /opt/homebrew/Cellar/llvm/18.1.5/bin
# Problem description
When an exception of custom type is thrown in the constructor for a class, and that constuctor gets invoked in the `return` statement of a function, this exception cannot be caught in the calling code.
So far the exact circumstances under which this happens or does not happen are unknown to me, but I have attached a small CMake project to demonstrate.
The problem does not occur with `std::runtime_error`, only with a subclass.
# How to run
- `export CC=/opt/homebrew/Cellar/llvm/18.1.5/bin/clang CXX=/opt/homebrew/Cellar/llvm/18.1.5/bin/clang++`
- `cmake ..`
- `make && ./test`
# Result
```
ld: warning: dylib (/opt/homebrew/opt/llvm/lib/c++/libc++.dylib) was built for newer macOS version (12.7) than being linked (12.6)
[100%] Built target test
Throwing
libc++abi: terminating due to uncaught exception of type Error: hallo
Abort trap: 6
```
# Minimal reproducible project
Here is a minimal cmake project (with build artifacts on my machine, in case that is relevant)
[clang-wtf.zip](https://github.com/llvm/llvm-project/files/15309445/clang-wtf.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVUGP2zoO_jXKhRjDVmI3OeSQyWzQHoouOl1sbwtapiNtZcmQ6Mnk_foHyUkm0_ZSPCAwYpEiP378SGOM5uiItqJ-FPXTAifWPmxZ02COms8eQ2-iXrS-O2-FXMLzOTIN8Mn1XpRPotzNzwf48iyWOxhQ-QiVLJqivlowKJ1su3G0BNFYo7y7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