http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48578
Summary: Range-based for-loops do not compile when -nostdinc is given Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: jobnoor...@gmail.com Created attachment 23965 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23965 Simple file which produces the error When using range-based for-loops when -nostdinc is given, GCC gives an error about 'begin' and 'end' not being declared while they definitely are. I've attached a simple file which produces this error. Here's the output of "g++ -v -save-temps -std=c++0x -nostdinc main.cpp": Using built-in specs. COLLECT_GCC=/usr/local/bin/g++ COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ./configure --enable-languages=c,c++ Thread model: posix gcc version 4.6.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-nostdinc' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /usr/local/libexec/gcc/i686-pc-linux-gnu/4.6.0/cc1plus -E -quiet -nostdinc -v -D_GNU_SOURCE main.cpp -mtune=generic -march=pentiumpro -std=c++0x -fpch-preprocess -o main.ii #include "..." search starts here: #include <...> search starts here: End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-nostdinc' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /usr/local/libexec/gcc/i686-pc-linux-gnu/4.6.0/cc1plus -fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=generic -march=pentiumpro -auxbase main -std=c++0x -version -o main.s GNU C++ (GCC) version 4.6.0 (i686-pc-linux-gnu) compiled by GNU C version 4.6.0, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++ (GCC) version 4.6.0 (i686-pc-linux-gnu) compiled by GNU C version 4.6.0, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 07532dd28c9f528a39c397b207537ed2 main.cpp: In function ‘int main()’: main.cpp:11:18: error: ‘begin’ was not declared in this scope main.cpp:11:18: error: ‘end’ was not declared in this scope