[cfe-dev] Late Parsed Template support for PCH

Douglas Gregor dgregor at apple.com
Fri Jul 26 11:11:07 PDT 2013


On Jul 25, 2013, at 10:22 AM, Nico Weber <thakis at chromium.org> wrote:

> On Wed, Jul 24, 2013 at 7:58 PM, Tom Honermann <thonermann at coverity.com> wrote:
> On 07/24/2013 12:18 PM, Will Wilson wrote:
> Hi All,
> 
> I've discovered a rather nasty issue with -fdelayed-template-parsing
> enabled. If this is used to build a PCH all of the stored template
> tokens are lost leading an incomplete AST when the PCH is used to create
> the complete TU.
> 
> Is this by design or a missing feature for the serialization code?
> 
> I would guess a missing feature.  Problems can be demonstrated quite easily:
> 
> $ cat t.cpp
> template<typename T>
> T f(const T& t) {
>     return t;
> }
> 
> int main() {
>     f(5);
> }
> 
> $ clang --version
> clang version 3.3 (tags/RELEASE_33/final)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> 
> # No problems without -fdelayed-template-parsing...
> $ clang -emit-ast t.cpp
> $ clang -o t t.ast
> 
> # But with -fdelayed-template-parsing...
> $ clang -emit-ast -fdelayed-template-parsing t.cpp
> $ clang -o t t.ast
> /tmp/t-YAfQmm.o: In function `main':
> t.ast:(.text+0x14): undefined reference to `int f<int>(int const&)'
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> 
> It's probably a good idea to paste this into a bug report (http://llvm.org/bugs) to make sure it's not lost.

It’s already filed as

	http://llvm.org/bugs/show_bug.cgi?id=9992

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130726/e5ad66cd/attachment.html>


More information about the cfe-dev mailing list