c++ - Clang >= 3.3 in c++1y mode cannot parse <cstdio> header -
i have project correctly compiles , runs under g++ 4.8.1 , clang >= 3.3 in c++11 mode. however, when switch experimental -std=c++1y
mode, clang 3.3 (but not g++) chokes on <cstdio>
header indirectly included way of boost.test (so cannot change myself)
// /usr/include/c++/4.8/cstdio #include <stdio.h> // rid of macros defined in <stdio.h> in lieu of real functions. // ... #undef gets // ... namespace std { // ... using ::gets; // <-- error clang++ -std=c++1y // ... }
with following error message:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:119:11: error: no member named 'gets' in global namespace
on this tutorial on how set modern c++ environment, similar lookup problem max_align_t
encountered. recommendation there use sed script surround unknown symbols #ifdef __clang__
macros, seems fragile approach.
setup: plain 64-bit linux mint 15
g++ (ubuntu 4.8.1-2ubuntu1~13.04) 4.8.1
ubuntu clang version 3.3-3~raring1 (branches/release_33) (based on llvm 3.3)
questions:
- what causing erorr? there no
__clang__
macro anywhere near code in question, , clang in c++11 mode has no trouble @ all. - is language problem (does c++14 else c++11 importing c compatible symbols global
std
namespace)? - do need change include paths? (i use cmake automatically select header paths, , switch modes inside cmakelists.txt)
- does clang have switch resolve this?
this note in gets
manpage looks relevant:
iso c11 removes specification of gets() c language, , since version 2.16, glibc header files don't expose function declaration if
_isoc11_source
feature test macro defined.
probably should be
#if !_isoc11_source using ::gets; #endif
Comments
Post a Comment