On OS X, simple C++ program gives incorrect results (which are a result of command-line options 'c++03' vs 'c++11')

前端 未结 2 707
栀梦
栀梦 2020-12-03 22:46

This simple program (when compiled on Linux) will CORRECTLY give two different answers based on whether it\'s compiled with -std=c++0x or not.

Problem:

2条回答
  •  [愿得一人]
    2020-12-03 23:31

    It appears to be an issue with clang using libstdc++ by default rather than libc++. Compiling like this: clang++ -std=c++0x -stdlib=libc++ test.cpp results in the expected output.

提交回复
热议问题