Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelfTest fails to compile when using MinGW #2447

Closed
Swat-SomeBug opened this issue Jun 4, 2022 · 1 comment
Closed

SelfTest fails to compile when using MinGW #2447

Swat-SomeBug opened this issue Jun 4, 2022 · 1 comment
Labels

Comments

@Swat-SomeBug
Copy link

Describe the bug
Error when compiling UsageTests/Misc.tests.cpp:517:5 with MinGW

error: expected 'catch' before '__except'
  517 |     __except (1)

Expected behavior
Compilation with error.

Reproduction steps
Steps to reproduce the bug.
Using MinGW (tested on Fedora) run the following command inside the build directory

cmake .. -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DCMAKE_BUILD_TYPE=Debug -DCATCH_DEVELOPMENT_BUILD=ON
cmake --build . --target SelfTest

Platform information:

  • OS: Fedora 36
  • Compiler+version: x86_64-w64-mingw32-g++ (GCC) 11.2.1 20211019 (Fedora MinGW 11.2.1-5.fc36)
  • Catch version: v3.0.1

Additional context
On first reading the function throw_and_catch() defined in tests/SelfTest/UsageTests/Misc.tests.cpp is used to test SEH on windows. The section is enabled using CATCH_PLATFORM_WINDOWS which includes MinGW. Maybe disable this section for MinGW?

@horenmar horenmar added the Bug label Jun 5, 2022
horenmar added a commit that referenced this issue Jun 5, 2022
MinGW doesn't support `__try` and friends at all, while Clang
only supports it partially, and the test would require some
changes to make it work there. Since this is only a test, we can
afford to keep it MSVC-only.

Closes #2447
@horenmar
Copy link
Member

horenmar commented Jun 5, 2022

Thanks for the report.

nicramage pushed a commit to nicramage/Catch2 that referenced this issue Feb 1, 2024
MinGW doesn't support `__try` and friends at all, while Clang
only supports it partially, and the test would require some
changes to make it work there. Since this is only a test, we can
afford to keep it MSVC-only.

Closes catchorg#2447
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants