Description / Steps to reproduce the issue
The default C++26 contract violation handler provided by
libstdc++exp.a is not resolved when linking a program with
-fcontracts on MINGW64.
The archive contains the expected symbol, but it is defined as a weak
symbol and does not appear to be extracted automatically by the linker.
Steps to reproduce
- Create a code file that uses the C++26 contracts such as this code
# bug_repro.cpp
void f(int value)
pre(value > 0)
{ }
int main()
{ f(1); }
- attempt to compile it using
c++ -std=c++26 -fcontracts bug_repro.cpp -o bug_repro.exe
Environment
- C++ version :
c++.exe (Rev5, Built by MSYS2 project) 16.1.0
- ld version :
GNU ld (GNU Binutils) 2.46.1
- mingw-w64-x86_64-gcc version :
mingw-w64-x86_64-gcc 16.1.0-5
- mingw-w64-x86_64-gcc-libs version :
mingw-w64-x86_64-gcc-libs 16.1.0-5
- mingw-w64-x86_64-binutils version :
mingw-w64-x86_64-binutils 2.46.1-2
Expected behavior
The program should compile without any kind of error.
Actual behavior
The compiler output this error twice (for the proposed bug_repro.cpp):
undefined reference to `handle_contract_violation(std::contracts::contract_violation const&)'
Verification
Windows Version
MINGW64_NT-10.0-26200
MINGW environments affected
Are you willing to submit a PR?
No response
Description / Steps to reproduce the issue
The default C++26 contract violation handler provided by
libstdc++exp.ais not resolved when linking a program with-fcontractson MINGW64.The archive contains the expected symbol, but it is defined as a weak
symbol and does not appear to be extracted automatically by the linker.
Steps to reproduce
c++ -std=c++26 -fcontracts bug_repro.cpp -o bug_repro.exeEnvironment
c++.exe (Rev5, Built by MSYS2 project) 16.1.0GNU ld (GNU Binutils) 2.46.1mingw-w64-x86_64-gcc 16.1.0-5mingw-w64-x86_64-gcc-libs 16.1.0-5mingw-w64-x86_64-binutils 2.46.1-2Expected behavior
The program should compile without any kind of error.
Actual behavior
The compiler output this error twice (for the proposed bug_repro.cpp):
Verification
Windows Version
MINGW64_NT-10.0-26200
MINGW environments affected
Are you willing to submit a PR?
No response