This test program:

# 1 "test.cc"
# 1 "np.h" 1
# 1 "Math.h" 1 3 4
template<class T> static inline void push(T* element, T** head)
{
 element->m_flink = *head;
 *head = element;
}

produces:

In file included from test.cc:2:
Math.h:1: error: template with C linkage

If I delete the "# 1 "Math.h" 1 3 4" then it works.

Strangely enough, it also works on different builds of the same version: for
example, the native (i386) build, as well as a build targeted to
mipsel-netbsdelf, both accept the test program without complaint.

The failing compiler's --verbose output is:

mips64el-elf-g++ --verbose
Using built-in specs.
Target: mips64el-elf
Configured with: /buildarea/GCC40/gcc-4.0.0/configure
--prefix=/usr/local/EQLGCC_v7/mips64el --enable-languages=c,c++
--target=mips64el-elf --with-newlib --with-arch=sb1 --with-tune=sb1
--with-gnu-as --with-gnu-ld
Thread model: single
gcc version 4.0.0

-- 
           Summary: Spurious "template with C linkage" error message
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pkoning at equallogic dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-unknown-netbsdelf1.6.2
  GCC host triplet: i386-unknown-netbsdelf1.6.2
GCC target triplet: mips64el-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21656

Reply via email to