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

Newest release header v2.10.1 won't compile #1782

Closed
maryamshalaby opened this issue Oct 21, 2019 · 1 comment
Closed

Newest release header v2.10.1 won't compile #1782

maryamshalaby opened this issue Oct 21, 2019 · 1 comment

Comments

@maryamshalaby
Copy link

maryamshalaby commented Oct 21, 2019

When compiling using MinGW following error message shows

In file included from try.cpp:2:0:
catch.hpp: In member function 'virtual std::__cxx11::string Catch::Matchers::Floating::WithinUlpsMatcher::describe() const':
catch.hpp:11434:76: error: no matching function for call to 'step(float, double, const uint64_t&)'
             write(ret, step(static_cast<float>(m_target), -INFINITY, m_ulps));
                                                                            ^
catch.hpp:11338:4: note: candidate: template<class FP> FP Catch::{anonymous}::step(FP, FP, uint64_t)
 FP step(FP start, FP direction, uint64_t steps) {
    ^~~~
catch.hpp:11338:4: note:   template argument deduction/substitution failed:
catch.hpp:11434:76: note:   deduced conflicting types for parameter 'FP' ('float' and 'double')
             write(ret, step(static_cast<float>(m_target), -INFINITY, m_ulps));
                                                                            ^
catch.hpp:11436:76: error: no matching function for call to 'step(float, double, const uint64_t&)'
             write(ret, step(static_cast<float>(m_target),  INFINITY, m_ulps));
                                                                            ^
catch.hpp:11338:4: note: candidate: template<class FP> FP Catch::{anonymous}::step(FP, FP, uint64_t)
 FP step(FP start, FP direction, uint64_t steps) {
    ^~~~
catch.hpp:11338:4: note:   template argument deduction/substitution failed:
catch.hpp:11436:76: note:   deduced conflicting types for parameter 'FP' ('float' and 'double')
             write(ret, step(static_cast<float>(m_target),  INFINITY, m_ulps));
                                                                            ^ 

Tried compiling earlier release, v2.10.0, smooth sailing.

Reproduction steps
Code example (same one in tutorial)
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include "catch.hpp"

unsigned int Factorial( unsigned int number ) {
return number <= 1 ? number : Factorial(number-1)*number;
}

TEST_CASE( "Factorials are computed", "[factorial]" ) {
REQUIRE( Factorial(1) == 1 );
REQUIRE( Factorial(2) == 2 );
REQUIRE( Factorial(3) == 6 );
REQUIRE( Factorial(10) == 3628800 );
}

in CLI -->>> g++ trial.cpp

Platform information:

  • OS: Windows 10
  • Compiler+version: gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)
  • Target: mingw32
  • Thread model: win32
  • Catch version: v2.10.1
@horenmar
Copy link
Member

The error means that your stdlib is non-conforming and INFINITY is a double instead of the float it is supposed to be. Luckily it is not too hard to work around.

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

No branches or pull requests

2 participants