Bug 83101 - stod, stold was not declared
Summary: stod, stold was not declared
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.4.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-21 22:36 UTC by Nicolas Gama
Modified: 2017-11-21 23:26 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Gama 2017-11-21 22:36:56 UTC
in the g++-5 package in ubuntu artful (g++-5 (Ubuntu 5.5.0-1ubuntu1) 5.4.1 20171010)

the c++11 functions stod, stold are unavailable

(it seems that the macro _GLIBCXX_USE_C99 is not defined by the -std=c++11 or -std=gnu++11 flag)

minimal example: a.cpp
-----------
#include <iostream>   // std::cout
#include <string>     // std::string, std::stod

int main ()
{
  std::string orbits ("90613.305");
  double pluto = std::stod (orbits);
  return 0;
}
----------

g++-5 -std=c++11 a.cpp
-> a.cpp: In function 'int main()':
a.cpp:7:18: error: 'stod' is not a member of 'std'
   double pluto = std::stod (orbits);

The problem does not appear with g++-6, g++-7.
Comment 1 Andreas Schwab 2017-11-21 22:42:23 UTC
gcc 5 is out of maintenance.
Comment 2 Jonathan Wakely 2017-11-21 23:26:25 UTC
You should report this to Ubuntu instead.

I suspect you're using glibc 2.26 which has a bug that causes GCC to misdetect its C99 support. Ubuntu should patch it.