Clang crashes when compiling with C++ 26, libc++ and using modules
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
While I was building the project with `libstdc++`, there were no problems. However, when switching to `libc++`, the `clang` crashes.
# Output
```
Stack dump:
0. Program arguments: /usr/bin/clang++ -I/home/mmaker/SomeProject/build/generated -I/home/mmaker/SomeProject/SRC -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/speech-dispatcher -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glycin-2 -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/cloudproviders -I/usr/include/gio-unix-2.0 -I/usr/include/fribidi -O3 -DNDEBUG -std=gnu++26 -stdlib=libc++ -MD -MT CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o -MF CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o.d @CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o.modmap -o CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o -c /home/mmaker/SomeProject/SRC/Core/SpeechSystem.cppm
1. parser at end of file
2. Per-file LLVM IR generation
3. /usr/bin/../include/c++/v1/__new/allocate.h:35:1: Generating code for declaration 'std::__libcpp_allocate'
#0 0x00007f023bd56aed llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.22.1+0x956aed)
#1 0x00007f023bd545c7 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/libLLVM.so.22.1+0x9545c7)
#2 0x00007f023bc1c9f9 (/usr/lib/libLLVM.so.22.1+0x81c9f9)
#3 0x00007f023ae4d2d0 (/usr/lib/libc.so.6+0x3e2d0)
#4 0x00007f0245bd3aa0 (/usr/lib/libclang-cpp.so.22.1+0x5d3aa0)
#5 0x00007f02477cb859 clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(clang::GlobalDecl, unsigned int, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/usr/lib/libclang-cpp.so.22.1+0x21cb859)
#6 0x00007f0247903b7b clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::CallBase**) (/usr/lib/libclang-cpp.so.22.1+0x2303b7b)
#7 0x00007f024796cb9c (/usr/lib/libclang-cpp.so.22.1+0x236cb9c)
#8 0x00007f024796404b (/usr/lib/libclang-cpp.so.22.1+0x236404b)
#9 0x00007f0247968edb (/usr/lib/libclang-cpp.so.22.1+0x2368edb)
#10 0x00007f0247967bdf clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/usr/lib/libclang-cpp.so.22.1+0x2367bdf)
#11 0x00007f0247afa174 clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) (/usr/lib/libclang-cpp.so.22.1+0x24fa174)
#12 0x00007f0247b0b998 clang::CodeGen::CodeGenFunction::EmitIfStmt(clang::IfStmt const&) (/usr/lib/libclang-cpp.so.22.1+0x250b998)
#13 0x00007f0247b0c523 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/lib/libclang-cpp.so.22.1+0x250c523)
#14 0x00007f0247b8b1f2 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/usr/lib/libclang-cpp.so.22.1+0x258b1f2)
#15 0x00007f0247ba01bb clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/lib/libclang-cpp.so.22.1+0x25a01bb)
#16 0x00007f0247befb0c clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/libclang-cpp.so.22.1+0x25efb0c)
#17 0x00007f0247beb704 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/libclang-cpp.so.22.1+0x25eb704)
#18 0x00007f0247bf62c7 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62c7)
#19 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#20 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#21 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#22 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#23 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#24 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#25 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#26 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#27 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#28 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#29 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#30 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#31 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#32 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#33 0x00007f0247bf62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#34 0x00007f0247bf89b7 clang::CodeGen::CodeGenModule::Release() (/usr/lib/libclang-cpp.so.22.1+0x25f89b7)
#35 0x00007f0247c8bda5 (/usr/lib/libclang-cpp.so.22.1+0x268bda5)
#36 0x00007f0247b837f7 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/libclang-cpp.so.22.1+0x25837f7)
#37 0x00007f0248662220 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/libclang-cpp.so.22.1+0x3062220)
#38 0x00007f0245edacb4 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.22.1+0x8dacb4)
#39 0x00007f024860d3ec clang::FrontendAction::Execute() (/usr/lib/libclang-cpp.so.22.1+0x300d3ec)
#40 0x00007f024857b301 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.22.1+0x2f7b301)
#41 0x00007f02486c80b0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.22.1+0x30c80b0)
#42 0x000055b557129f98 cc1_main(llvm::ArrayRef, char const*, void*) (/usr/bin/clang+++0x15f98)
#43 0x000055b5571208d1 (/usr/bin/clang+++0xc8d1)
#44 0x000055b557120a9c (/usr/bin/clang+++0xca9c)
#45 0x00007f0248120265 (/usr/lib/libclang-cpp.so.22.1+0x2b20265)
#46 0x00007f023bc1ce38 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/usr/lib/libLLVM.so.22.1+0x81ce38)
#47 0x00007f0248120ca5 (/usr/lib/libclang-cpp.so.22.1+0x2b20ca5)
#48 0x00007f02480d28da clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/libclang-cpp.so.22.1+0x2ad28da)
#49 0x00007f02480d384c clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl>&, bool) const (/usr/lib/libclang-cpp.so.22.1+0x2ad384c)
#50 0x00007f02480ec316 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/usr/lib/libclang-cpp.so.22.1+0x2aec316)
#51 0x000055b557125c07 clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+++0x11c07)
#52 0x000055b5571200c0 main (/usr/bin/clang+++0xc0c0)
#53 0x00007f023ae366c1 __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:83:3
#54 0x00007f023ae367f9 call_init /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:128:20
#55 0x00007f023ae367f9 __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:347:5
#56 0x000055b557120125 _start (/usr/bin/clang+++0xc125)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 22.1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang++: note: diagnostic msg:
...
Stack dump:
0. Program arguments: /usr/bin/clang++ -I/home/mmaker/SomeProject/build/generated -I/home/mmaker/SomeProject/SRC -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -I/usr/include/speech-dispatcher -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glycin-2 -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/cloudproviders -I/usr/include/gio-unix-2.0 -I/usr/include/fribidi -O3 -DNDEBUG -std=gnu++26 -stdlib=libc++ -MD -MT CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o -MF CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o.d @CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o.modmap -o CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o -c /home/mmaker/SomeProject/SRC/Proxies/Output.cppm
1. parser at end of file
2. Per-file LLVM IR generation
3. /usr/bin/../include/c++/v1/__new/allocate.h:35:1: Generating code for declaration 'std::__libcpp_allocate'
#0 0x00007fe50f756aed llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/libLLVM.so.22.1+0x956aed)
#1 0x00007fe50f7545c7 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib/libLLVM.so.22.1+0x9545c7)
#2 0x00007fe50f61c9f9 (/usr/lib/libLLVM.so.22.1+0x81c9f9)
#3 0x00007fe50e84d2d0 (/usr/lib/libc.so.6+0x3e2d0)
#4 0x00007fe5195d3aa0 (/usr/lib/libclang-cpp.so.22.1+0x5d3aa0)
#5 0x00007fe51b1cb859 clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(clang::GlobalDecl, unsigned int, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/usr/lib/libclang-cpp.so.22.1+0x21cb859)
#6 0x00007fe51b303b7b clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::CallBase**) (/usr/lib/libclang-cpp.so.22.1+0x2303b7b)
#7 0x00007fe51b36cb9c (/usr/lib/libclang-cpp.so.22.1+0x236cb9c)
#8 0x00007fe51b36404b (/usr/lib/libclang-cpp.so.22.1+0x236404b)
#9 0x00007fe51b368edb (/usr/lib/libclang-cpp.so.22.1+0x2368edb)
#10 0x00007fe51b367bdf clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/usr/lib/libclang-cpp.so.22.1+0x2367bdf)
#11 0x00007fe51b4fa174 clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) (/usr/lib/libclang-cpp.so.22.1+0x24fa174)
#12 0x00007fe51b50b998 clang::CodeGen::CodeGenFunction::EmitIfStmt(clang::IfStmt const&) (/usr/lib/libclang-cpp.so.22.1+0x250b998)
#13 0x00007fe51b50c523 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/lib/libclang-cpp.so.22.1+0x250c523)
#14 0x00007fe51b58b1f2 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/usr/lib/libclang-cpp.so.22.1+0x258b1f2)
#15 0x00007fe51b5a01bb clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/lib/libclang-cpp.so.22.1+0x25a01bb)
#16 0x00007fe51b5efb0c clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/libclang-cpp.so.22.1+0x25efb0c)
#17 0x00007fe51b5eb704 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/lib/libclang-cpp.so.22.1+0x25eb704)
#18 0x00007fe51b5f62c7 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62c7)
#19 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#20 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#21 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#22 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#23 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#24 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#25 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#26 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#27 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#28 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#29 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#30 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#31 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#32 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#33 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#34 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#35 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#36 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#37 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#38 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#39 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#40 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#41 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#42 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#43 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#44 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#45 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#46 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#47 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#48 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#49 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#50 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#51 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#52 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#53 0x00007fe51b5f62e3 clang::CodeGen::CodeGenModule::EmitDeferred() (/usr/lib/libclang-cpp.so.22.1+0x25f62e3)
#54 0x00007fe51b5f89b7 clang::CodeGen::CodeGenModule::Release() (/usr/lib/libclang-cpp.so.22.1+0x25f89b7)
#55 0x00007fe51b68bda5 (/usr/lib/libclang-cpp.so.22.1+0x268bda5)
#56 0x00007fe51b5837f7 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/libclang-cpp.so.22.1+0x25837f7)
#57 0x00007fe51c062220 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/libclang-cpp.so.22.1+0x3062220)
#58 0x00007fe5198dacb4 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/libclang-cpp.so.22.1+0x8dacb4)
#59 0x00007fe51c00d3ec clang::FrontendAction::Execute() (/usr/lib/libclang-cpp.so.22.1+0x300d3ec)
#60 0x00007fe51bf7b301 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/libclang-cpp.so.22.1+0x2f7b301)
#61 0x00007fe51c0c80b0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/libclang-cpp.so.22.1+0x30c80b0)
#62 0x00005592495dff98 cc1_main(llvm::ArrayRef, char const*, void*) (/usr/bin/clang+++0x15f98)
#63 0x00005592495d68d1 (/usr/bin/clang+++0xc8d1)
#64 0x00005592495d6a9c (/usr/bin/clang+++0xca9c)
#65 0x00007fe51bb20265 (/usr/lib/libclang-cpp.so.22.1+0x2b20265)
#66 0x00007fe50f61ce38 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref) (/usr/lib/libLLVM.so.22.1+0x81ce38)
#67 0x00007fe51bb20ca5 (/usr/lib/libclang-cpp.so.22.1+0x2b20ca5)
#68 0x00007fe51bad28da clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/usr/lib/libclang-cpp.so.22.1+0x2ad28da)
#69 0x00007fe51bad384c clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl>&, bool) const (/usr/lib/libclang-cpp.so.22.1+0x2ad384c)
#70 0x00007fe51baec316 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl>&) (/usr/lib/libclang-cpp.so.22.1+0x2aec316)
#71 0x00005592495dbc07 clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+++0x11c07)
#72 0x00005592495d60c0 main (/usr/bin/clang+++0xc0c0)
#73 0x00007fe50e8366c1 __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:83:3
#74 0x00007fe50e8367f9 call_init /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:128:20
#75 0x00007fe50e8367f9 __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:347:5
#76 0x00005592495d6125 _start (/usr/bin/clang+++0xc125)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 22.1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```
# Files
`Output-bc7bf8.sh`
```
# Crash reproducer for clang version 22.1.1
# Driver args: "--driver-mode=g++" "-I" "/home/mmaker/SomeProject/build/generated" "-I" "/home/mmaker/SomeProject/SRC" "-I" "/usr/include/at-spi-2.0" "-I" "/usr/include/dbus-1.0" "-I" "/usr/lib/dbus-1.0/include" "-I" "/usr/include/glib-2.0" "-I" "/usr/lib/glib-2.0/include" "-I" "/usr/include/libmount" "-I" "/usr/include/blkid" "-I" "/usr/include/sysprof-6" "-I" "/usr/include/speech-dispatcher" "-I" "/usr/include/gtk-3.0" "-I" "/usr/include/pango-1.0" "-I" "/usr/include/harfbuzz" "-I" "/usr/include/gdk-pixbuf-2.0" "-I" "/usr/include/glycin-2" "-I" "/usr/include/cairo" "-I" "/usr/include/freetype2" "-I" "/usr/include/libpng16" "-I" "/usr/include/pixman-1" "-I" "/usr/include/cloudproviders" "-I" "/usr/include/gio-unix-2.0" "-I" "/usr/include/fribidi" "-O3" "-D" "NDEBUG" "-std=gnu++26" "-stdlib=libc++" "-MD" "-MT" "CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o" "-MF" "CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o.d" "-x" "c++-module" "-fmodule-output=CMakeFiles/SomeProject.dir/Proxies.Output.pcm" "-fmodule-file=Core.Outputs=CMakeFiles/SomeProject.dir/Core.Outputs.pcm" "-fmodule-file=Proxies.Object=CMakeFiles/SomeProject.dir/Proxies.Object.pcm" "-fmodule-file=Core.AppState=CMakeFiles/SomeProject.dir/Core.AppState.pcm" "-fmodule-file=Core.Environment=CMakeFiles/SomeProject.dir/Core.Environment.pcm" "-fmodule-file=Core.FocusManager=CMakeFiles/SomeProject.dir/Core.FocusManager.pcm" "-fmodule-file=Core.Logger=CMakeFiles/SomeProject.dir/Core.Logger.pcm" "-fmodule-file=Core.Object=CMakeFiles/SomeProject.dir/Core.Object.pcm" "-fmodule-file=Core.Outputs.Speech=CMakeFiles/SomeProject.dir/Core.Outputs.Speech.pcm" "-fmodule-file=Core.Rect=CMakeFiles/SomeProject.dir/Core.Rect.pcm" "-fmodule-file=Core.Singleton=CMakeFiles/SomeProject.dir/Core.Singleton.pcm" "-fmodule-file=Core.Text=CMakeFiles/SomeProject.dir/Core.Text.pcm" "-fmodule-file=Platforms.Linux.Object=CMakeFiles/SomeProject.dir/Platforms.Linux.Object.pcm" "-fmodule-file=Platforms.Linux.SpeechEngine=CMakeFiles/SomeProject.dir/Platforms.Linux.SpeechEngine.pcm" "-fmodule-file=Traits.RefCountedObject=CMakeFiles/SomeProject.dir/Traits.RefCountedObject.pcm" "-fmodule-file=Traits.SpeechEngine=CMakeFiles/SomeProject.dir/Traits.SpeechEngine.pcm" "-o" "CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o" "-c" "/home/mmaker/SomeProject/SRC/Proxies/Output.cppm"
# Original command: "/usr/bin/clang++" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-O3" "-emit-obj" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "Output.cppm" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/mmaker/SomeProject/build" "-fcoverage-compilation-dir=/home/mmaker/SomeProject/build" "-resource-dir" "/usr/lib/clang/22" "-dependency-file" "CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o.d" "-MT" "CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o" "-sys-header-deps" "-I" "/home/mmaker/SomeProject/build/generated" "-I" "/home/mmaker/SomeProject/SRC" "-I" "/usr/include/at-spi-2.0" "-I" "/usr/include/dbus-1.0" "-I" "/usr/lib/dbus-1.0/include" "-I" "/usr/include/glib-2.0" "-I" "/usr/lib/glib-2.0/include" "-I" "/usr/include/libmount" "-I" "/usr/include/blkid" "-I" "/usr/include/sysprof-6" "-I" "/usr/include/speech-dispatcher" "-I" "/usr/include/gtk-3.0" "-I" "/usr/include/pango-1.0" "-I" "/usr/include/harfbuzz" "-I" "/usr/include/gdk-pixbuf-2.0" "-I" "/usr/include/glycin-2" "-I" "/usr/include/cairo" "-I" "/usr/include/freetype2" "-I" "/usr/include/libpng16" "-I" "/usr/include/pixman-1" "-I" "/usr/include/cloudproviders" "-I" "/usr/include/gio-unix-2.0" "-I" "/usr/include/fribidi" "-D" "NDEBUG" "-internal-isystem" "/usr/bin/../include/c++/v1" "-internal-isystem" "/usr/lib/clang/22/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/15.2.1/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-std=gnu++26" "-fdeprecated-macro" "-ferror-limit" "19" "-stack-protector" "2" "-fgnuc-version=4.2.1" "-fno-implicit-modules" "-fmodule-file=Core.Outputs=CMakeFiles/SomeProject.dir/Core.Outputs.pcm" "-fmodule-file=Proxies.Object=CMakeFiles/SomeProject.dir/Proxies.Object.pcm" "-fmodule-file=Core.AppState=CMakeFiles/SomeProject.dir/Core.AppState.pcm" "-fmodule-file=Core.Environment=CMakeFiles/SomeProject.dir/Core.Environment.pcm" "-fmodule-file=Core.FocusManager=CMakeFiles/SomeProject.dir/Core.FocusManager.pcm" "-fmodule-file=Core.Logger=CMakeFiles/SomeProject.dir/Core.Logger.pcm" "-fmodule-file=Core.Object=CMakeFiles/SomeProject.dir/Core.Object.pcm" "-fmodule-file=Core.Outputs.Speech=CMakeFiles/SomeProject.dir/Core.Outputs.Speech.pcm" "-fmodule-file=Core.Rect=CMakeFiles/SomeProject.dir/Core.Rect.pcm" "-fmodule-file=Core.Singleton=CMakeFiles/SomeProject.dir/Core.Singleton.pcm" "-fmodule-file=Core.Text=CMakeFiles/SomeProject.dir/Core.Text.pcm" "-fmodule-file=Platforms.Linux.Object=CMakeFiles/SomeProject.dir/Platforms.Linux.Object.pcm" "-fmodule-file=Platforms.Linux.SpeechEngine=CMakeFiles/SomeProject.dir/Platforms.Linux.SpeechEngine.pcm" "-fmodule-file=Traits.RefCountedObject=CMakeFiles/SomeProject.dir/Traits.RefCountedObject.pcm" "-fmodule-file=Traits.SpeechEngine=CMakeFiles/SomeProject.dir/Traits.SpeechEngine.pcm" "-fskip-odr-check-in-gmf" "-fmodules-reduced-bmi" "-fmodule-output=CMakeFiles/SomeProject.dir/Proxies.Output.pcm" "-fcxx-exceptions" "-fexceptions" "-vectorize-loops" "-vectorize-slp" "-faddrsig" "-fdwarf2-cfi-asm" "-o" "CMakeFiles/SomeProject.dir/SRC/Proxies/Output.cppm.o" "-x" "c++" "/home/mmaker/SomeProject/SRC/Proxies/Output.cppm"
"/usr/bin/clang++" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-O3" "-emit-obj" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "Output.cppm" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/mmaker/SomeProject/build" "-fcoverage-compilation-dir=/home/mmaker/SomeProject/build" "-sys-header-deps" "-D" "NDEBUG" "-std=gnu++26" "-fdeprecated-macro" "-ferror-limit" "19" "-stack-protector" "2" "-fgnuc-version=4.2.1" "-fno-implicit-modules" "-fmodule-file=Core.Outputs=CMakeFiles/SomeProject.dir/Core.Outputs.pcm" "-fmodule-file=Proxies.Object=CMakeFiles/SomeProject.dir/Proxies.Object.pcm" "-fmodule-file=Core.AppState=CMakeFiles/SomeProject.dir/Core.AppState.pcm" "-fmodule-file=Core.Environment=CMakeFiles/SomeProject.dir/Core.Environment.pcm" "-fmodule-file=Core.FocusManager=CMakeFiles/SomeProject.dir/Core.FocusManager.pcm" "-fmodule-file=Core.Logger=CMakeFiles/SomeProject.dir/Core.Logger.pcm" "-fmodule-file=Core.Object=CMakeFiles/SomeProject.dir/Core.Object.pcm" "-fmodule-file=Core.Outputs.Speech=CMakeFiles/SomeProject.dir/Core.Outputs.Speech.pcm" "-fmodule-file=Core.Rect=CMakeFiles/SomeProject.dir/Core.Rect.pcm" "-fmodule-file=Core.Singleton=CMakeFiles/SomeProject.dir/Core.Singleton.pcm" "-fmodule-file=Core.Text=CMakeFiles/SomeProject.dir/Core.Text.pcm" "-fmodule-file=Platforms.Linux.Object=CMakeFiles/SomeProject.dir/Platforms.Linux.Object.pcm" "-fmodule-file=Platforms.Linux.SpeechEngine=CMakeFiles/SomeProject.dir/Platforms.Linux.SpeechEngine.pcm" "-fmodule-file=Traits.RefCountedObject=CMakeFiles/SomeProject.dir/Traits.RefCountedObject.pcm" "-fmodule-file=Traits.SpeechEngine=CMakeFiles/SomeProject.dir/Traits.SpeechEngine.pcm" "-fskip-odr-check-in-gmf" "-fmodules-reduced-bmi" "-fmodule-output=CMakeFiles/SomeProject.dir/Proxies.Output.pcm" "-fcxx-exceptions" "-fexceptions" "-vectorize-loops" "-vectorize-slp" "-faddrsig" "-fdwarf2-cfi-asm" "-x" "c++" "Output-bc7bf8.cppm"
```
`Output-bc7bf8.cppm`
```c++
# 3 "/home/mmaker/SomeProject/SRC/Proxies/Output.cppm" 2
export module Proxies.Output;
import Core.Outputs;
import Proxies.Object;
template class TUnknownProxy {
Variant m_variant;
protected:
TUnknownProxy() = default;
explicit TUnknownProxy(Variant&& variant) : m_variant(std::move(variant)) {}
public:
void With(auto&& func) {
std::visit(
[&](auto&& output) -> void {
using T = std::decay_t;
if constexpr (!std::is_same_v) {
func(output);
}
},
m_variant);
}
};
export class COutputProxy final : public TUnknownProxy {
public:
COutputProxy() = default;
explicit COutputProxy(OutputVariant&& variant) : TUnknownProxy(std::move(variant)) {}
void Stop() {
With([](auto&& out) { out.Stop(); });
}
void FocusChange(CObjectProxy obj) {
With([obj](auto&& out) { out.FocusChange(obj); });
}
void StateChange(CObjectProxy obj) {
With([obj](auto&& out) { out.StateChange(obj); });
}
void ValueChange(CObjectProxy obj) {
With([obj](auto&& out) { out.ValueChange(obj); });
}
void CursorMove(CObjectProxy obj) {
With([obj](auto&& out) { out.CursorMove(obj); });
}
};
```
`SpeechSystem-0393f2.sh`
```
# Crash reproducer for clang version 22.1.1
# Driver args: "--driver-mode=g++" "-I" "/home/mmaker/SomeProject/build/generated" "-I" "/home/mmaker/SomeProject/SRC" "-I" "/usr/include/at-spi-2.0" "-I" "/usr/include/dbus-1.0" "-I" "/usr/lib/dbus-1.0/include" "-I" "/usr/include/glib-2.0" "-I" "/usr/lib/glib-2.0/include" "-I" "/usr/include/libmount" "-I" "/usr/include/blkid" "-I" "/usr/include/sysprof-6" "-I" "/usr/include/speech-dispatcher" "-I" "/usr/include/gtk-3.0" "-I" "/usr/include/pango-1.0" "-I" "/usr/include/harfbuzz" "-I" "/usr/include/gdk-pixbuf-2.0" "-I" "/usr/include/glycin-2" "-I" "/usr/include/cairo" "-I" "/usr/include/freetype2" "-I" "/usr/include/libpng16" "-I" "/usr/include/pixman-1" "-I" "/usr/include/cloudproviders" "-I" "/usr/include/gio-unix-2.0" "-I" "/usr/include/fribidi" "-O3" "-D" "NDEBUG" "-std=gnu++26" "-stdlib=libc++" "-MD" "-MT" "CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o" "-MF" "CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o.d" "-x" "c++-module" "-fmodule-output=CMakeFiles/SomeProject.dir/Core.SpeechSystem.pcm" "-fmodule-file=Core.Encoding=CMakeFiles/SomeProject.dir/Core.Encoding.pcm" "-fmodule-file=Core.Environment=CMakeFiles/SomeProject.dir/Core.Environment.pcm" "-fmodule-file=Core.Logger=CMakeFiles/SomeProject.dir/Core.Logger.pcm" "-fmodule-file=Core.UnicodeData=CMakeFiles/SomeProject.dir/Core.UnicodeData.pcm" "-fmodule-file=Traits.SpeechEngine=CMakeFiles/SomeProject.dir/Traits.SpeechEngine.pcm" "-fmodule-file=Core.AppState=CMakeFiles/SomeProject.dir/Core.AppState.pcm" "-fmodule-file=Core.Object=CMakeFiles/SomeProject.dir/Core.Object.pcm" "-fmodule-file=Core.Rect=CMakeFiles/SomeProject.dir/Core.Rect.pcm" "-fmodule-file=Core.Singleton=CMakeFiles/SomeProject.dir/Core.Singleton.pcm" "-fmodule-file=Core.Text=CMakeFiles/SomeProject.dir/Core.Text.pcm" "-fmodule-file=Platforms.Linux.Object=CMakeFiles/SomeProject.dir/Platforms.Linux.Object.pcm" "-fmodule-file=Platforms.Linux.SpeechEngine=CMakeFiles/SomeProject.dir/Platforms.Linux.SpeechEngine.pcm" "-fmodule-file=Traits.RefCountedObject=CMakeFiles/SomeProject.dir/Traits.RefCountedObject.pcm" "-o" "CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o" "-c" "/home/mmaker/SomeProject/SRC/Core/SpeechSystem.cppm"
# Original command: "/usr/bin/clang++" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-O3" "-emit-obj" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "SpeechSystem.cppm" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/mmaker/SomeProject/build" "-fcoverage-compilation-dir=/home/mmaker/SomeProject/build" "-resource-dir" "/usr/lib/clang/22" "-dependency-file" "CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o.d" "-MT" "CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o" "-sys-header-deps" "-I" "/home/mmaker/SomeProject/build/generated" "-I" "/home/mmaker/SomeProject/SRC" "-I" "/usr/include/at-spi-2.0" "-I" "/usr/include/dbus-1.0" "-I" "/usr/lib/dbus-1.0/include" "-I" "/usr/include/glib-2.0" "-I" "/usr/lib/glib-2.0/include" "-I" "/usr/include/libmount" "-I" "/usr/include/blkid" "-I" "/usr/include/sysprof-6" "-I" "/usr/include/speech-dispatcher" "-I" "/usr/include/gtk-3.0" "-I" "/usr/include/pango-1.0" "-I" "/usr/include/harfbuzz" "-I" "/usr/include/gdk-pixbuf-2.0" "-I" "/usr/include/glycin-2" "-I" "/usr/include/cairo" "-I" "/usr/include/freetype2" "-I" "/usr/include/libpng16" "-I" "/usr/include/pixman-1" "-I" "/usr/include/cloudproviders" "-I" "/usr/include/gio-unix-2.0" "-I" "/usr/include/fribidi" "-D" "NDEBUG" "-internal-isystem" "/usr/bin/../include/c++/v1" "-internal-isystem" "/usr/lib/clang/22/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/15.2.1/../../../../x86_64-pc-linux-gnu/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-std=gnu++26" "-fdeprecated-macro" "-ferror-limit" "19" "-stack-protector" "2" "-fgnuc-version=4.2.1" "-fno-implicit-modules" "-fmodule-file=Core.Encoding=CMakeFiles/SomeProject.dir/Core.Encoding.pcm" "-fmodule-file=Core.Environment=CMakeFiles/SomeProject.dir/Core.Environment.pcm" "-fmodule-file=Core.Logger=CMakeFiles/SomeProject.dir/Core.Logger.pcm" "-fmodule-file=Core.UnicodeData=CMakeFiles/SomeProject.dir/Core.UnicodeData.pcm" "-fmodule-file=Traits.SpeechEngine=CMakeFiles/SomeProject.dir/Traits.SpeechEngine.pcm" "-fmodule-file=Core.AppState=CMakeFiles/SomeProject.dir/Core.AppState.pcm" "-fmodule-file=Core.Object=CMakeFiles/SomeProject.dir/Core.Object.pcm" "-fmodule-file=Core.Rect=CMakeFiles/SomeProject.dir/Core.Rect.pcm" "-fmodule-file=Core.Singleton=CMakeFiles/SomeProject.dir/Core.Singleton.pcm" "-fmodule-file=Core.Text=CMakeFiles/SomeProject.dir/Core.Text.pcm" "-fmodule-file=Platforms.Linux.Object=CMakeFiles/SomeProject.dir/Platforms.Linux.Object.pcm" "-fmodule-file=Platforms.Linux.SpeechEngine=CMakeFiles/SomeProject.dir/Platforms.Linux.SpeechEngine.pcm" "-fmodule-file=Traits.RefCountedObject=CMakeFiles/SomeProject.dir/Traits.RefCountedObject.pcm" "-fskip-odr-check-in-gmf" "-fmodules-reduced-bmi" "-fmodule-output=CMakeFiles/SomeProject.dir/Core.SpeechSystem.pcm" "-fcxx-exceptions" "-fexceptions" "-vectorize-loops" "-vectorize-slp" "-faddrsig" "-fdwarf2-cfi-asm" "-o" "CMakeFiles/SomeProject.dir/SRC/Core/SpeechSystem.cppm.o" "-x" "c++" "/home/mmaker/SomeProject/SRC/Core/SpeechSystem.cppm"
"/usr/bin/clang++" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-O3" "-emit-obj" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "SpeechSystem.cppm" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=none" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/mmaker/SomeProject/build" "-fcoverage-compilation-dir=/home/mmaker/SomeProject/build" "-sys-header-deps" "-D" "NDEBUG" "-std=gnu++26" "-fdeprecated-macro" "-ferror-limit" "19" "-stack-protector" "2" "-fgnuc-version=4.2.1" "-fno-implicit-modules" "-fmodule-file=Core.Encoding=CMakeFiles/SomeProject.dir/Core.Encoding.pcm" "-fmodule-file=Core.Environment=CMakeFiles/SomeProject.dir/Core.Environment.pcm" "-fmodule-file=Core.Logger=CMakeFiles/SomeProject.dir/Core.Logger.pcm" "-fmodule-file=Core.UnicodeData=CMakeFiles/SomeProject.dir/Core.UnicodeData.pcm" "-fmodule-file=Traits.SpeechEngine=CMakeFiles/SomeProject.dir/Traits.SpeechEngine.pcm" "-fmodule-file=Core.AppState=CMakeFiles/SomeProject.dir/Core.AppState.pcm" "-fmodule-file=Core.Object=CMakeFiles/SomeProject.dir/Core.Object.pcm" "-fmodule-file=Core.Rect=CMakeFiles/SomeProject.dir/Core.Rect.pcm" "-fmodule-file=Core.Singleton=CMakeFiles/SomeProject.dir/Core.Singleton.pcm" "-fmodule-file=Core.Text=CMakeFiles/SomeProject.dir/Core.Text.pcm" "-fmodule-file=Platforms.Linux.Object=CMakeFiles/SomeProject.dir/Platforms.Linux.Object.pcm" "-fmodule-file=Platforms.Linux.SpeechEngine=CMakeFiles/SomeProject.dir/Platforms.Linux.SpeechEngine.pcm" "-fmodule-file=Traits.RefCountedObject=CMakeFiles/SomeProject.dir/Traits.RefCountedObject.pcm" "-fskip-odr-check-in-gmf" "-fmodules-reduced-bmi" "-fmodule-output=CMakeFiles/SomeProject.dir/Core.SpeechSystem.pcm" "-fcxx-exceptions" "-fexceptions" "-vectorize-loops" "-vectorize-slp" "-faddrsig" "-fdwarf2-cfi-asm" "-x" "c++" "SpeechSystem-0393f2.cppm"
```
`SpeechSystem-0393f2.cppm`
```c++
# 6 "/home/mmaker/SomeProject/SRC/Core/SpeechSystem.cppm" 2
export module Core.SpeechSystem;
import Core.Encoding;
import Core.Environment;
import Core.Logger;
import Core.UnicodeData;
import Traits.SpeechEngine;
export class SpeechSystem final : TModule<"SpeechSystem"> {
SpeechEngineVariant m_variant;
explicit SpeechSystem() { m_variant.emplace(); }
~SpeechSystem() = default;
public:
static auto& GetInstance() {
static SpeechSystem instance;
return instance;
}
template decltype(auto) WithEngine(F&& func) {
return std::visit(
[&](auto&& eng) -> decltype(auto) {
using T = std::decay_t;
if constexpr (!std::is_same_v) {
return func(eng);
}
},
m_variant);
}
[[nodiscard]] inline auto SpeakIfHasParameter(unsigned long long parameter, auto&& on_success, auto&& on_fail)
-> SpeechSystem& {
WithEngine([&](auto& engine) {
SSpeechEngineInfo info = engine.GetInfo().value_or({});
if (info.supported_parameters & SpeechEngineParameter::SSML) {
engine.SetParameter(SpeechEngineParameter::SSML, true);
engine.Speak(on_success());
}
else
engine.Speak(on_fail());
});
return *this;
}
inline auto Speak(std::string_view message, bool interrupt = false, bool ssml = false) -> SpeechSystem& {
WithEngine([&](auto& engine) {
SSpeechEngineInfo info = engine.GetInfo().value_or({});
if (info.supported_parameters & SpeechEngineParameter::SSML) {
engine.SetParameter(SpeechEngineParameter::SSML, ssml);
}
if (interrupt) {
engine.Stop();
engine.Cancel();
}
engine.Speak(message);
});
return *this;
}
inline auto Spell(std::string_view message, bool interrupt = false, bool ssml = false) -> SpeechSystem& {
WithEngine([&](auto& engine) {
SSpeechEngineInfo info = engine.GetInfo().value_or({});
if (interrupt) {
engine.Stop();
engine.Cancel();
}
CUtf8View message_view(message);
for (uint32_t c : message_view) {
if (IsPunctuation(c)) {
engine.Speak(PunctuationToName(static_cast(c)));
}
else {
auto result = EncodeUtf8(c);
std::string_view character_data(result.bytes, result.size);
engine.Speak(character_data);
}
}
});
return *this;
}
inline auto Stop() -> SpeechSystem& {
WithEngine([&](auto& engine) {
engine.Stop();
engine.Cancel();
});
return *this;
}
};
```
Contributor guide
Assessment
This issue has not been assessed yet.