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.
latetemplatefunc.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
