[PATCH] ClassScopeFunctionSpecializationDecl issue with -fdelayed-template-parsing

Will Wilson will at indefiant.com
Wed Apr 24 03:42:45 PDT 2013


*ping* Anyone available for a quick review of this patch?

Cheers,
Will.


On 19 April 2013 21:18, Will Wilson <will at indefiant.com> wrote:

> Hi All,
>
> This patch attempts to resolve an issue seen when a CXXMethodDecl
> (produced via a ClassScopeFunctionSpecializationDecl) is encountered
> with -fdelayed-template-parsing enabled. This is needed to successfully
> compile the VS2012 xlocnum header (see: class numpunct) which is used by a
> number of other core MS STL headers .
>
> The existing logic in Parser::ParseLateTemplatedFuncDef() uses a special
> case if the FunctionDecl was a Declarator with template parameter lists, in
> which case most of the parent scope was ignored. Unfortunately this is the
> code path used by CXXMethodDecl's generated from
> ClassScopeFunctionSpecializationDecl's. This would break name lookup for
> parameter's named in the parent context:
>
>   test/SemaTemplate/ms-function-specialization-class-scope.cpp:55:4: error:
>       unknown type name 'T'
>           T a = 3;
>           ^
>
> The approach I've taken may be missing a lower-level issue, as it simply
> attempts to ensure the parent lookup scope is always restored. Oddly, there
> seems to be a number of checks for ClassTemplatePartialSpecializationDecl
> in the delayed template parsing code that never get called - is
> this evidence that the design changed at some time?
>
> Either way, this patch seems to resolve the issue and passes all existing
> tests. I've also added an additional test run to
> ms-function-specialization-class-scope.cpp with -fdelayed-template-parsing
> enabled in order to reproduce the original issue.
>
> - Will.
>
>


-- 
*Indefiant Ltd.*
*
*
Firsby Lodge, New Main Road, Scamblesby, Louth, Lincs LN11 9XH UK
*Tel: +44 20 8123 7663 England Registered No. 07936820 VAT No. **128556202*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130424/220f7ce3/attachment.html>


More information about the cfe-commits mailing list