diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-09-22 22:14:56 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-09-22 22:14:56 +0000 |
commit | fdde47061d8ff0b481414ccf69ebdc47c2216274 (patch) | |
tree | 1113c22f8f85b82199e847d444ff7d1a6007445d /test/Parser/DelayedTemplateParsing.cpp | |
parent | a3e86edd0793be4604cf503f25013415bbdd3abc (diff) |
[microsoft] Fix a bug in -fdelayed-template-parsing mode where we were not reentering the delayed function context correctly. The problem was that all template params were reintroduced inside the same scope. So if we had a situation where we had 2 template params with the same name at different scope then clang would generate an error about ambiguous name.
The solution is to create a new ParseScope(Scope::TemplateParamScope) for each template scope that we want to reenter. (from the outmost to the innermost scope)
This fixes some errors when parsing MFC code with clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140344 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/DelayedTemplateParsing.cpp')
-rw-r--r-- | test/Parser/DelayedTemplateParsing.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/Parser/DelayedTemplateParsing.cpp b/test/Parser/DelayedTemplateParsing.cpp index b447fff2f1..b02c4026c0 100644 --- a/test/Parser/DelayedTemplateParsing.cpp +++ b/test/Parser/DelayedTemplateParsing.cpp @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -fdelayed-template-parsing -fsyntax-only -verify %s +// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s template <class T> class A { void foo() { undeclared(); } - void foo2(); + void foo2(); }; template <class T> @@ -40,3 +40,22 @@ void undeclared() template <class T> void foo5() {} //expected-note {{previous definition is here}} template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}} + + + +namespace Inner_Outer_same_template_param_name { + +template <class T> +class Outmost { +public: + template <class T> + class Inner { + public: + void f() { + T* var; + } + }; +}; + +} + |