http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59555
Bug ID: 59555 Summary: bogus error: template with C linkage with preprocessed c++ file Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: amker.cheng at gmail dot com Created attachment 31478 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31478&action=edit preprocessed c++ file For attached preprocessed file, arm-none-eabi-g++ and m68k-unknown-elf-g++ give below error messages with either "-xc++" or "-xc++-cpp-output": In file included from /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/stringfwd.h:40:0, from /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:39, from /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:25, from ../../gcc/gcc/system.h:647, from ../../gcc/gcc/tree-loop-distribution.c:45: /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/memoryfwd.h:63:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/memoryfwd.h:66:3: error: template specialization with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/memoryfwd.h:70:3: error: template with C linkage In file included from /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:39:0, from /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:25, from ../../gcc/gcc/system.h:647, from ../../gcc/gcc/tree-loop-distribution.c:45: /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/stringfwd.h:52:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/stringfwd.h:55:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/stringfwd.h:59:3: error: template specialization with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/stringfwd.h:65:3: error: template specialization with C linkage In file included from /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:40:0, from /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:25, from ../../gcc/gcc/system.h:647, from ../../gcc/gcc/tree-loop-distribution.c:45: /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/postypes.h:111:3: error: template with C linkage In file included from /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:40:0, from /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:25, from ../../gcc/gcc/system.h:647, from ../../gcc/gcc/tree-loop-distribution.c:45: /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/postypes.h:214:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/bits/postypes.h:219:3: error: template with C linkage In file included from /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:25:0, from ../../gcc/gcc/system.h:647, from ../../gcc/gcc/tree-loop-distribution.c:45: /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:76:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:79:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:82:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:85:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:88:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:91:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:95:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:99:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:103:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:107:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:110:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:113:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:116:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:119:3: error: template with C linkage /daten/cross/m68k-linux/gcc-4.8/m68k-linux/include/c++/4.8.2/iosfwd:122:3: error: template with C linkage In file included from ../../gcc/gcc/system.h:647:0, from ../../gcc/gcc/tree-loop-distribution.c:45: /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2179:54: error: conflicting declaration of C function 'std::ostream& operator<<(std::ostream&, mpq_srcptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2178:16: note: previous declaration 'std::ostream& operator<<(std::ostream&, mpz_srcptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2180:54: error: conflicting declaration of C function 'std::ostream& operator<<(std::ostream&, mpf_srcptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2179:16: note: previous declaration 'std::ostream& operator<<(std::ostream&, mpq_srcptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2180:54: error: conflicting declaration of C function 'std::ostream& operator<<(std::ostream&, mpf_srcptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2178:16: note: previous declaration 'std::ostream& operator<<(std::ostream&, mpz_srcptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2182:51: error: conflicting declaration of C function 'std::istream& operator>>(std::istream&, mpq_ptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2181:16: note: previous declaration 'std::istream& operator>>(std::istream&, mpz_ptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2183:51: error: conflicting declaration of C function 'std::istream& operator>>(std::istream&, mpf_ptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2182:16: note: previous declaration 'std::istream& operator>>(std::istream&, mpq_ptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2183:51: error: conflicting declaration of C function 'std::istream& operator>>(std::istream&, mpf_ptr)' /daten/cross/m68k-linux/m68k-linux/sys-root/usr/include/gmp.h:2181:16: note: previous declaration 'std::istream& operator>>(std::istream&, mpz_ptr)' The messages disappear if I delete all "# ...file..." lines.