[compiler-rt] [llvm] [ASan] Do not instrument catch block parameters on Windows (PR #159618)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 18 13:42:32 PDT 2025
mstorsjo wrote:
This testcase fails to compile in mingw environments, with libc++ as a C++ standard library - https://github.com/mstorsjo/llvm-mingw/actions/runs/18608410056/job/53074081871:
```
D:\a\llvm-mingw\llvm-mingw\llvm-project\compiler-rt\test\asan\TestCases\Windows\basic_exception_handling.cpp:11:32: error: no matching conversion for functional-style cast from 'const char[6]' to 'std::exception'
11 | void throwInFunction() { throw std::exception("test2"); }
| ^~~~~~~~~~~~~~~~~~~~~~~
C:/llvm-mingw/include/c++/v1/__exception/exception.h:75:25: note: candidate constructor not viable: no known conversion from 'const char[6]' to 'const exception' for 1st argument
75 | _LIBCPP_HIDE_FROM_ABI exception(const exception&) _NOEXCEPT = default;
| ^ ~~~~~~~~~~~~~~~~
C:/llvm-mingw/include/c++/v1/__exception/exception.h:74:25: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
74 | _LIBCPP_HIDE_FROM_ABI exception() _NOEXCEPT {}
| ^
D:\a\llvm-mingw\llvm-mingw\llvm-project\compiler-rt\test\asan\TestCases\Windows\basic_exception_handling.cpp:16:11: error: no matching conversion for functional-style cast from 'const char[6]' to 'std::exception'
16 | throw std::exception("test1");
| ^~~~~~~~~~~~~~~~~~~~~~~
C:/llvm-mingw/include/c++/v1/__exception/exception.h:75:25: note: candidate constructor not viable: no known conversion from 'const char[6]' to 'const exception' for 1st argument
75 | _LIBCPP_HIDE_FROM_ABI exception(const exception&) _NOEXCEPT = default;
| ^ ~~~~~~~~~~~~~~~~
C:/llvm-mingw/include/c++/v1/__exception/exception.h:74:25: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
74 | _LIBCPP_HIDE_FROM_ABI exception() _NOEXCEPT {}
| ^
2 errors generated.
```
Looking at https://en.cppreference.com/w/cpp/error/exception/exception.html, I don't see any `std::exception` constructor taking a `const char*` parameter.
https://github.com/llvm/llvm-project/pull/159618
More information about the llvm-commits
mailing list