Zig Version
0.10.0-dev.3028+337147068
Steps to Reproduce
Hit this one on #11168 and realized it's a more general problem for libraries compiled with Zig.
// foo.cpp
#include<system_error>
std::error_condition foo() {
returnstd::generic_category().default_error_condition(ENOENT);
}// main.cpp
#include<system_error>
std::error_condition foo();
intmain() {
if (foo() != std::generic_category().default_error_condition(ENOENT)) {
fprintf(stderr, "error: errors compare unequal.\n");
}
}With clang:
$ clang++ foo.cpp -o libfoo.so -shared
$ clang++ main.cpp -lfoo -L. -lstdc++ -rpath . -o main
$ ./main
With zig c++:
$ zig c++ foo.cpp -o libfoo.so -shared
$ zig c++ main.cpp -lfoo -L. -lstdc++ -rpath . -o main
./build/zig c++ main.cpp -lfoo -L. -lstdc++ -rpath . -o main
zig: warning: -rpath .: 'linker' input unused [-Wunused-command-line-argument]
$ ./main
error: errors compare unequal.
Expected Behavior
Library should behave the same when compiled with Zig and with Clang.
Actual Behavior
Behavior diverges because Zig links libstdc++ statically by default
Zig Version
0.10.0-dev.3028+337147068
Steps to Reproduce
Hit this one on #11168 and realized it's a more general problem for libraries compiled with Zig.
With clang:
With
zig c++:Expected Behavior
Library should behave the same when compiled with Zig and with Clang.
Actual Behavior
Behavior diverges because Zig links
libstdc++statically by default