[cfe-dev] Late Parsed Template support for PCH

Nico Weber thakis at chromium.org
Thu Jul 25 10:22:34 PDT 2013


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.


>
>
> Tom.
>
>
> ______________________________**_________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/cfe-dev<http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130725/ed73d47f/attachment.html>


More information about the cfe-dev mailing list