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

Infinite recursion in Generators::populate with MSVC #2040

Closed
C4rsten opened this issue Oct 2, 2020 · 3 comments · Fixed by #2058
Closed

Infinite recursion in Generators::populate with MSVC #2040

C4rsten opened this issue Oct 2, 2020 · 3 comments · Fixed by #2058
Labels

Comments

@C4rsten
Copy link

C4rsten commented Oct 2, 2020

CATCH_TEST_CASE("Recursion Bug")
{
    int x = 42;
    auto test = GENERATE_COPY(1, x, 2 * x);
    CATCH_CHECK(test < 50);
}

This worked in 2.9.2 but now I get
single_include\catch2\catch.hpp(4027):warning C4717: 'Catch::Generators::Generators<int>::populate<int &>': recursive on all control paths, function will cause runtime stack overflow with MSVC 2017 Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27042 for x64.
It matches the wrong template.

A possible work-around is GENERATE_COPY(values<int>({1, x, 2 * x}));, but the above should work, right?

@horenmar
Copy link
Member

I can reproduce this with an up-to-date MSVC.

However, it doesn't reproduce with Clang/GCC, so I suspect the code runs into some MSVC bug, which is going to be hard to debug.

@horenmar
Copy link
Member

Does not reproduce with /permissive-...

@horenmar
Copy link
Member

So, this was almost definitely introduced in 6c9a255.

@horenmar horenmar added the Bug label Oct 20, 2020
TysonRayJones added a commit to QuEST-Kit/QuEST that referenced this issue Aug 7, 2023
This includes replicating (in a Catch2 v2 compatible way) the Catch2 patch for this Windows-specific issue:
catchorg/Catch2#2040
TysonRayJones added a commit to QuEST-Kit/QuEST that referenced this issue Aug 7, 2023
in addition to the existing CI build test.

This patch involved accelerating some tests to avoid timeouts, and replicating (in a Catch2 v2 compatible way) the Catch2 patch for this Windows-specific issue:
catchorg/Catch2#2040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants