Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[llvmg++] not enough templates are instantiated #817

Closed
lattner opened this issue Sep 28, 2004 · 3 comments
Closed

[llvmg++] not enough templates are instantiated #817

lattner opened this issue Sep 28, 2004 · 3 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead llvm-tools All llvm tools that do not have corresponding tag

Comments

@lattner
Copy link
Collaborator

lattner commented Sep 28, 2004

Bugzilla Link 445
Resolution FIXED
Resolved on Feb 22, 2010 12:43
Version 1.3
OS All

Extended Description

In the testcase below (reduced from llvm-llvm) does not ever emit an
instantiation of callDefaultCtor to the LLVM file, resulting in missing
symbols. The #include of and use of .empty() are required to trigger
this failure.


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

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

#include

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

void baz() { foo(callDefaultCtor); }

@lattner
Copy link
Collaborator Author

lattner commented Sep 28, 2004

assigned to @lattner

@lattner
Copy link
Collaborator Author

lattner commented Sep 28, 2004

Here is a reduced testcase. Note that marking callDefaultCtor 'inline' causes
it to be emitted! boggle


struct Pass {};

template
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); }

@lattner
Copy link
Collaborator Author

lattner commented Sep 28, 2004

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

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead llvm-tools All llvm tools that do not have corresponding tag
Projects
None yet
Development

No branches or pull requests

1 participant