First Last Prev Next    No search results available
Details
: [llvmg++] not enough templates are instantiated
Bug#: 445
: tools
: llvm-g++
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.3
: P2
: normal
: ---

:
: compile-fail
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <sabre@nondot.org>
Assigned To: Chris Lattner <sabre@nondot.org>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2004-09-27 21:15
In the testcase below (reduced from llvm-llvm) does not ever emit an
instantiation of callDefaultCtor<Pass> to the LLVM file, resulting in missing
symbols.  The #include of <string> and use of .empty() are required to trigger
this failure.

-----------

struct Pass {} ;
template<typename PassName>
Pass *callDefaultCtor() { return new PassName(); }

void foo(Pass *(*C)());

#include <string>

bool foo(std::string &X) {
  return X.empty();
}

void baz() { foo(callDefaultCtor<Pass>); }
------- Comment #1 From Chris Lattner 2004-09-27 21:38:41 -------
Here is a reduced testcase.  Note that marking callDefaultCtor 'inline' causes
it to be emitted! *boggle*

-----

struct Pass {};

template<typename PassName>
Pass *callDefaultCtor() { return new Pass(); }

void foo(Pass *(*C)());

struct basic_string {
  bool empty() const { return true; }
};

bool foo(basic_string &X) {
  return X.empty();
}
void baz() { foo(callDefaultCtor<Pass>); }
------- Comment #2 From Chris Lattner 2004-09-27 22:42:09 -------
This bug is fixed, patch here:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040927/018592.html

Testcase here:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040927/018591.html

It is amazing how all of that quality time spent in GDB ends up with a one line
fix, arg.

-Chris

First Last Prev Next    No search results available