error: ‘std::chars_format’ has not been declared

Viewed 766

A minimal part of my code is as follows:

#include <charconv>
#include <string_view>
#include <cmath>

int main() {

    return 0;
}

double strparse(std::string_view s, int field, int a, int b) {
    double candidates[3];
    auto format = std::chars_format::fixed;
    return 0;
}

However, compiling it under the command:

g++ -std=c++17 bob.cpp

Using g++ 9.2.1

returns:

bob.cpp: In function ‘double strparse(std::string_view, int, int, int)’:
bob.cpp:12:24: error: ‘std::chars_format’ has not been declared
   12 |     auto format = std::chars_format::fixed;
      |                        ^~~~~~~~~~~~

I'm not sure why this isn't compiling - can someone help?

Live demo

1 Answers
Related