This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/44910] New: Incorrect template with C linkage errors


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]