This is the mail archive of the 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++/21280] New: #pragma interface, templates, and "inline function used but never defined"

This bug report may be related to bug 20584, but I've got standalone compilable
code that not only produces a warning, but also fails to link.

File t.h:

#pragma interface

template<class T>
struct C
  explicit C(const T& t) : a(t) { }
  virtual ~C() { }
  T a;


#include "t.h"

struct A
  A() { }
  virtual ~A() { }

int main()
  A a;
  C<A> c(a);

> g++ -g -Wall
t.h:7: warning: inline function 'A::A(const A&)' used but never defined
/tmp/ccM01LV4.o(.gnu.linkonce.t._ZN1CI1AEC1ERKS0_+0x21): In function `C<A>::C(A
/home/jmaurer/IS/isgbe/servers/kfi/ undefined reference to `A::A(A const&)'

It used to work with gcc 3.4.3.

At the very least, the warning message should have an instantiation backtrace so
that the user knows that the "used" comes from the instantiation of C<A>.

           Summary: #pragma interface, templates, and "inline function used
                    but never defined"
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jens dot maurer at gmx dot net
                CC: Jens dot Maurer at is-teledata dot com,gcc-bugs at gcc
                    dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

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