[PATCH] D22955: [MSVC] Improved late parsing of template functions.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 10:53:49 PST 2016


ABataev added a comment.

In https://reviews.llvm.org/D22955#598081, @rnk wrote:

> If I understand correctly, this patch takes template function patterns, copies them into instantiated context, parses them in that context, and then instantiates them in that context. The key difference is that today's fdelayed-template-parsing doesn't parse the body of the function in the instantiation context. It just allows access to names at global scope that were encountered after the template pattern.
>
> So, if I run -ast-dump, do I end up seeing both the pattern and the fully instantiated function with this patch?
>
> This patch removes a lot of warnings from our tests. We lose a lot of our ability to diagnose MSVC-isms with this approach. I wonder if there's a better way to do delayed template parsing the way we were before, but make the template arguments available during lookup.




In https://reviews.llvm.org/D22955#598081, @rnk wrote:

> If I understand correctly, this patch takes template function patterns, copies them into instantiated context, parses them in that context, and then instantiates them in that context. The key difference is that today's fdelayed-template-parsing doesn't parse the body of the function in the instantiation context. It just allows access to names at global scope that were encountered after the template pattern.


Yes, you're right.

> So, if I run -ast-dump, do I end up seeing both the pattern and the fully instantiated function with this patch?

No, you will see only instantiated function.

> This patch removes a lot of warnings from our tests. We lose a lot of our ability to diagnose MSVC-isms with this approach. I wonder if there's a better way to do delayed template parsing the way we were before, but make the template arguments available during lookup.

Yes, this is the price we should pay for better MSVC compatibility. I tried several different solutions before ended up with this one and have to say this one is the best I was able to find.


https://reviews.llvm.org/D22955





More information about the cfe-commits mailing list