You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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)
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.
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)
System Info
Compiler info
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
Minimal reproducible project
Here is a minimal cmake project (with build artifacts on my machine, in case that is relevant)
clang-wtf.zip
The text was updated successfully, but these errors were encountered: