Works in VS 2019 but not in GCC?


Hello to all!
Does anyone know why this code would work in VS 2019 but not in gcc?

bool IsOnlyNumbers(std::string& str)
return std::all_of(str.begin(), str.end(), std::isdigit);

I checked all test cases from ISBN in VS and it works. Not in codingame though…

  1. there are no clairvoyants here. show error text from gcc
  2. better place for such questions is


Very useful, thank you…
Made it work in a lambda. Just like with many other puzzles in codingame, the testcases’ results are buggy and the score I get is not calculated properly.


No offense meant, but there’s between a few hundreds and a few thousand persons proving you wrong on each puzzle. Historically, every time someone blamed the tests/validators, it turned out their code had a bug.

Also, it is very plausible for a compiler to be more permissive than another, or to support different features. MSVC is well reputed to be on the permissive side and GCC on the restrictive side. A common occurrence is how MSVC tolerates non-const references on temporary object in a function argument, where GCC refuses to do so.

Like zerlyony said, showing the error message with the code will be much more helpful to you.