Created attachment 25466
exception source file
Using exceptions in shared libraries compiled with -fvisibility=hidden yields
the wrong results
Steps to Reproduce:
1. Compile the attached files with the following commands:
clang++ -shared -stdlib=libc++ -fvisibility=hidden exception.cpp -o libexception.so
clang++ -stdlib=libc++ test.cpp libexception.so -o exception_test
2. Run the exception_test binary
Actual Results:
The output is "Error value = -2"
Expected Results:
The output should be "Error value = 1"
This error cannot be reproduced when either removing the -fvisibility=hidden
switch or
when using -stdlib=libstdc++. So using -stdlib=libstdc++ together with -
fvisibility=hidden
produces the correct output.
Reproduced with clang-13 on Arch Linux.
exception.cpp
(333 bytes, text/x-c++src)exception.h
(274 bytes, text/x-chdr)test.cpp
(223 bytes, text/x-c++src)