https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67256
Bug ID: 67256 Summary: [C++11] Global scope contaminated with symbols from mathcalls.h Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: michal.fita at gmail dot com Target Milestone: --- Created attachment 36198 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36198&action=edit The test code. I have problem with GCC 4.9.2 on Jessie, where with -std=c++11 I cannot compile my code. I attached the test example which compiles with: g++ -o test g++mathcalls-error.cpp But doesn't compile with: g++ -o test -std=c++11 g++mathcalls-error.cpp Producing following errors: g++mathcalls-error.cpp:7:15: error: ‘namespace log { }’ redeclared as different kind of symbol namespace log { ^ In file included from /usr/include/features.h:374:0, from /usr/include/x86_64-linux-gnu/c++/4.9/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/4.9/bits/c++config.h:430, from /usr/include/c++/4.9/utility:68, from /usr/include/c++/4.9/algorithm:60, from g++mathcalls-error.cpp:2: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:109:1: note: previous declaration ‘double log(double)’ __MATHCALL (log,, (_Mdouble_ __x)); ^ g++mathcalls-error.cpp:19:15: error: ‘namespace sin { }’ redeclared as different kind of symbol namespace sin { ^ In file included from /usr/include/features.h:374:0, from /usr/include/x86_64-linux-gnu/c++/4.9/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/4.9/bits/c++config.h:430, from /usr/include/c++/4.9/utility:68, from /usr/include/c++/4.9/algorithm:60, from g++mathcalls-error.cpp:2: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:65:1: note: previous declaration ‘double sin(double)’ __MATHCALL (sin,, (_Mdouble_ __x)); ^ g++mathcalls-error.cpp: In function ‘int main()’: g++mathcalls-error.cpp:28:5: error: ‘log’ is not a class, namespace, or enumeration log::info("Test %s", "sinner"); ^ g++mathcalls-error.cpp:29:5: error: ‘sin’ is not a class, namespace, or enumeration sin::cardinal(666); ^ So, this may not be bug inside the compiler (however studies of inclusion chain leads nowhere), but with the standard set of headers. This cause symbols related to math functions be present in global scope instead of std namespace. This effectively block us from using namespaces like "log" or "sin" in our huge codebase if we want to move toward C++11 standard.