If a C++ program includes a standard header (I use <string.h> in my example), a typedef typedef unsigned int uint; becomes visible. The identifier does not appear in the 2011 ISO C++ standard. The problem occurs with "g++ -std=c++11 -pedantic". It does not occur with "g++ -std=c++03 -pedantic". To demonstrate: $ cat uint_bug.cpp #include <string> int uint; int main() { } $ g++ --version g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++ -std=c++03 -pedantic -c uint_bug.cpp $ g++ -std=c++11 -pedantic -c uint_bug.cpp uint_bug.cpp:2:5: error: ‘int uint’ redeclared as different kind of symbol In file included from /usr/include/stdlib.h:320:0, from /usr/include/c++/4.7/cstdlib:66, from /usr/include/c++/4.7/ext/string_conversions.h:37, from /usr/include/c++/4.7/bits/basic_string.h:2814, from /usr/include/c++/4.7/string:54, from uint_bug.cpp:1: /usr/include/x86_64-linux-gnu/sys/types.h:153:22: error: previous declaration of ‘typedef unsigned int uint’ $ Running "g++ -std=c++11 -E uint_bug.cpp" shows that the declaration "typedef int uint;", along with similar declarations for "ushort" and "ulong", appears in /usr/include/x86_64-linux-gnu/sys/types.h. Apparently the macro __USE_MISC is defined. (The same macro appears to be defined with "-std=c++03", but the problem doesn't occur with that option; I haven't figured out why.) I'm not sure whether the bug is in the compiler or in the libc headers. (The same problem occurs with clang++ version 3.4.)
This came up in this question: http://stackoverflow.com/q/21356275/827263 on Stack Overflow; the original version of the question used "uint" without declaring it and compiled without error (at least without that error being flagged).
Glibc defines it: #ifdef __USE_MISC /* Old compatibility names for C types. */ typedef unsigned long int ulong; typedef unsigned short int ushort; typedef unsigned int uint; #endif __USE_MISC is defined because G++ defines _GNU_SOURCE, which is well known to cause problems, e.g. PR 11196 and PR 51749 This particular namespace pollution only occurs with C++11 because <string> only needs to #include <cstdlib> in C++11 mode to define std::to_string, std::stoi etc. but in general the problem affects C++98 too. *** This bug has been marked as a duplicate of bug 51749 ***