Bug 21656 - Spurious "template with C linkage" error message
Summary: Spurious "template with C linkage" error message
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Richard Sandiford
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-18 21:22 UTC by Paul Koning
Modified: 2005-07-09 08:56 UTC (History)
1 user (show)

See Also:
Host:
Target: mips64el-elf
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-07-04 09:36:39


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Koning 2005-05-18 21:22:24 UTC
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
Comment 1 Andrew Pinski 2005-05-18 21:26:11 UTC
This is a target problem, it is not defining NO_IMPLICIT_EXTERN_C.
Comment 2 Paul Koning 2005-05-18 21:41:35 UTC
Thanks.  I added that to config/mips/elf.h and it works correctly now.
Comment 3 Richard Sandiford 2005-07-04 09:36:39 UTC
OK, I'll run that change through dejagnu and commit if there are no problems.
Comment 4 GCC Commits 2005-07-09 08:46:42 UTC
Subject: Bug 21656

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rsandifo@gcc.gnu.org	2005-07-09 08:46:35

Modified files:
	gcc            : ChangeLog 
	gcc/config/mips: elf.h 

Log message:
	PR target/21656
	* config/mips/elf.h (NO_IMPLICIT_EXTERN_C): Define.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9392&r2=2.9393
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/mips/elf.h.diff?cvsroot=gcc&r1=1.63&r2=1.64

Comment 5 Richard Sandiford 2005-07-09 08:55:45 UTC
Committed to mainline.

Let me know if this is a regression from an earlier release.  I'll then apply
the patch to the appropriate branches.  I'll tentatively close this PR as fixed
in the meantime.
Comment 6 Richard Sandiford 2005-07-09 08:56:59 UTC
Sorry, changed "Reported against" field instead of "Target Milestone".