Open
Description
Code:
// CPP VERSION = c++17
#include <exception>
#include <iostream>
struct FileNameNotProvidedToCompiler : public std::exception {
inline virtual const char* what() const noexcept override {
return "getting the file name";
}
};
int main() {
try {
throw FileNameNotProvidedToCompiler();
} catch (const FileNameNotProvidedToCompiler& excep) {
std::cerr << excep.what() << std::endl;
}
std::cerr << "\n >>>> Done <<<<";
}
Issue:
- The above code is being compiled with this command:
clang++ experi.cpp -o experi.exe -Wall -std=c++17 -fsanitize=address
- There are no compilation errors.
- But after executing the executable (i.e. experi.exe), the output is nothing.
- Neither the ASAN displayed any problem nor the
std::cerr
. - After removing the flag "-fsanitize=address",
the code compiles with no issues and the executable ran with no problem.
clang++ experi.cpp -o experi.exe -Wall -std=c++17
- I ran the same code in online compilers, and it ran with no issues.
- I also used onlinegdb.com's extra compiler flags feature where I placed "-fsanitize=address" as a compiler flag and it ran smoothly. (NOTE: onlinegdb.com uses GCC for C/C++).
My specs:
- OS: Windows 11 24H2
- Processor: i5 10th gen (x64 arch)
- RAM: 8 GB DDR4
- Clang-version: 20.1.6
Please fix this issue and if I am lacking some knowledge, please teach me. Thank You in Advance🩵.