AshBF icon indicating copy to clipboard operation
AshBF copied to clipboard

error: use of dynamic_cast requires -frtti

Open Vort opened this issue 2 years ago • 0 comments

When I execute ninja -j 3, following error appears:

[1/15] Building CXX object CMakeFiles/ashbf.dir/cmake_pch.hxx.pch
FAILED: CMakeFiles/ashbf.dir/cmake_pch.hxx.pch
D:\msys64\clang64\bin\clang++.exe -DFMT_USE_DOUBLE=0 -DFMT_USE_FLOAT=0 -DFMT_USE_LONG_DOUBLE=0 -IE:/_Projects/_Test/AshBF/vendor/fmt/include -flto=thin -fno-pic -fno-exceptions -fno-rtti -fno-asynchronous-unwind-tables -O3 -DNDEBUG -Wall -Wextra -std=c++20 -gsplit-dwarf -ggdb -O3 -DNDEBUG -Winvalid-pch -fpch-instantiate-templates -Xclang -emit-pch -Xclang -include -Xclang E:/_Projects/_Test/AshBF/build/CMakeFiles/ashbf.dir/cmake_pch.hxx -x c++-header -MD -MT CMakeFiles/ashbf.dir/cmake_pch.hxx.pch -MF CMakeFiles\ashbf.dir\cmake_pch.hxx.pch.d -o CMakeFiles/ashbf.dir/cmake_pch.hxx.pch -c E:/_Projects/_Test/AshBF/build/CMakeFiles/ashbf.dir/cmake_pch.hxx.cxx
In file included from <built-in>:1:
In file included from E:/_Projects/_Test/AshBF/build/CMakeFiles/ashbf.dir/cmake_pch.hxx:5:
In file included from E:/_Projects/_Test/AshBF/src/pch.hpp:17:
E:/_Projects/_Test/AshBF/vendor/fmt/include/fmt/ostream.h:95:19: error: use of dynamic_cast requires -frtti
  if (auto* buf = dynamic_cast<std::__stdoutbuf<char>*>(os.rdbuf()))
                  ^
1 error generated.
[2/15] Building CXX object vendor/fmt/CMakeFiles/fmt.dir/src/os.cc.obj
[3/15] Building CXX object vendor/fmt/CMakeFiles/fmt.dir/src/format.cc.obj
ninja: build stopped: subcommand failed.

If I remove -fno-rtti here: https://github.com/AsuMagic/AshBF/blob/4c6269fc720353f39b86e125dea10f9e0abc429a/CMakeLists.txt#L12 , program builds fine and works correctly.

Compiler: clang version 15.0.7 OS: Windows 7 SP1 x64

Vort avatar Apr 19 '23 10:04 Vort