[cfe-commits] [PATCH][MS][Review request] - Microsoft missing typename
Francois Pichet
pichet2000 at gmail.com
Mon Nov 7 04:19:39 PST 2011
ok now with the patch.
On Mon, Nov 7, 2011 at 6:32 AM, Francois Pichet <pichet2000 at gmail.com> wrote:
> Hi,
>
> This is my solution to the problem of missing typename in MSVC headers.
> This patch resolves all the cases of missing typename in MSVC 2008
> standard c++ headers and in MFC code.
>
>
> This deals with 2 situations:
>
> 1. T::a where T is a TemplateTypeParmType.
> In this case we depend on late template parsing to subtitute 'T' with
> the actual type and then perform a name lookup to check if 'a' is a
> type.
>
>
> 2. ClassName<T>::a
> In this case, we'll perform a name lookup in the class template
> 'ClassName' to check if 'a' ia a type in the pattern.
>
>
> Example:
>
> class C {
> public:
> typedef int type_1;
> };
>
> template <class T>
> class D {
> public:
> typedef T type_2;
> };
>
> template <class T>
> void f() {
> T::type_1 var1; // case 1.
> D<T>::type_2 var2; // case 2.
>
> }
> int main() {
> f<C>();
> }
>
> I admit this is a hack, that's why I am asking for review.
> But given the way clang and MSVC differ in handling template code, I
> think this is the best we can do.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MicrosoftMissingTypename.patch
Type: application/octet-stream
Size: 12940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111107/0c14d92f/attachment.obj>
More information about the cfe-commits
mailing list