[Bug 1739778] [NEW] G++ 5.4 does not compile some C++11 code without workaround flag

Mateusz Szychowski 1739778 at bugs.launchpad.net
Fri Dec 22 13:25:43 UTC 2017


Public bug reported:

Simple C++ code example to trigger this error:
#include <string>
#include <iostream>

int main()
{
  std::cout << std::to_string(4) << std::endl;
  return 0;
}

Building with:
g++-5 -std=c++11 main.cpp -o main

will yield this error:
main.cpp: In function 'int main()':
main.cpp:6:16: error: 'to_string' is not a member of 'std'
   std::cout << std::to_string(4) << std::endl;
                ^

however when building with "D_GLIBCXX_USE_C99" flag it works:
g++-5 -D_GLIBCXX_USE_C99 -std=c++11 main.cpp -o main

I do not think it should be necessary to provide this flag, especially
when G++ 5.4 does not need this flag on other distributions,
std::to_string was introduced in C++11, so -std=c++11 should be enough.

This was tested on Ubuntu 17.10

** Affects: gcc-5 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-5 in Ubuntu.
https://bugs.launchpad.net/bugs/1739778

Title:
  G++ 5.4 does not compile some C++11 code without workaround flag

Status in gcc-5 package in Ubuntu:
  New

Bug description:
  Simple C++ code example to trigger this error:
  #include <string>
  #include <iostream>

  int main()
  {
    std::cout << std::to_string(4) << std::endl;
    return 0;
  }

  Building with:
  g++-5 -std=c++11 main.cpp -o main

  will yield this error:
  main.cpp: In function 'int main()':
  main.cpp:6:16: error: 'to_string' is not a member of 'std'
     std::cout << std::to_string(4) << std::endl;
                  ^

  however when building with "D_GLIBCXX_USE_C99" flag it works:
  g++-5 -D_GLIBCXX_USE_C99 -std=c++11 main.cpp -o main

  I do not think it should be necessary to provide this flag, especially
  when G++ 5.4 does not need this flag on other distributions,
  std::to_string was introduced in C++11, so -std=c++11 should be
  enough.

  This was tested on Ubuntu 17.10

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1739778/+subscriptions



More information about the foundations-bugs mailing list