public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44910]  New: Incorrect template with C linkage errors
@ 2010-07-11 15:08 alex at alex-smith dot me dot uk
  2010-07-11 15:32 ` [Bug c++/44910] " jakub at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: alex at alex-smith dot me dot uk @ 2010-07-11 15:08 UTC (permalink / raw)
  To: gcc-bugs

I have a x-compiler with a custom target for my hobby operating system. In the
x-compiler's installation directory sys-include is symlinked to the directory
in my OS's source tree containing all the userspace headers. Despite this my
build system was passing -I<path to header directory> to G++.

When I removed that argument, I started getting "template with C linkage"
errors from C++ code. There were no differences between the preprocessed input
with and without that argument, except that the file/line number information
was different, which obviously shouldn't be causing that error.

>From comparing the two sets of preprocessed input, I have determined that the
following code will cause the errors:

# 1 "somefilename" 1 3 4
template <typename T> class Test {};

This code, however, compiles without issues:

# 1 "somefilename" 1
template <typename T> class Test {};

Both are compiled with "x86_64-kiwi-g++ -c -o testcase.o testcase.cc". The full
error that I receive with the first piece of code is:

In file included from testcase.cc:1:0:
somefilename:1:1: error: template with C linkage

GCC was configured with the following options:

../gcc-4.5.0/configure --prefix=/home/alex/bin/kiwi-cross/x86_64-kiwi
--target=x86_64-kiwi --enable-languages=c,c++ --disable-libstdcxx-pch
--disable-shared --enable-lto


-- 
           Summary: Incorrect template with C linkage errors
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alex at alex-smith dot me dot uk
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-kiwi


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/44910] Incorrect template with C linkage errors
  2010-07-11 15:08 [Bug c++/44910] New: Incorrect template with C linkage errors alex at alex-smith dot me dot uk
@ 2010-07-11 15:32 ` jakub at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-11 15:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2010-07-11 15:32 -------
That means the configuration of your hobby target doesn't define
NO_IMPLICIT_EXTERN_C and thus all system headers are considered to be
implicitly surrounded by extern "C".


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-11 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-11 15:08 [Bug c++/44910] New: Incorrect template with C linkage errors alex at alex-smith dot me dot uk
2010-07-11 15:32 ` [Bug c++/44910] " jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).