On Tue, Apr 29, 2014 at 6:05 PM, Hans Wennborg <[email protected]> wrote:
> Hi rnk, majnemer,
>
> This patch seems to fix the problem. Please take a look.
>
> http://reviews.llvm.org/D3555
>
> Files:
>   lib/Parse/ParseTemplate.cpp
>   test/Parser/DelayedTemplateParsing.cpp
>
> Index: lib/Parse/ParseTemplate.cpp
> ===================================================================
> --- lib/Parse/ParseTemplate.cpp
> +++ lib/Parse/ParseTemplate.cpp
> @@ -1255,15 +1255,23 @@
>            new ParseScope(this, Scope::TemplateParamScope));
>        Actions.ActOnReenterTemplateScope(getCurScope(), MD);
>        ++CurTemplateDepthTracker;
> -    } else if (CXXRecordDecl *MD = dyn_cast_or_null<CXXRecordDecl>(*II)) {
> -      bool IsClassTemplate = MD->getDescribedClassTemplate() != 0;
> +    } else if (CXXRecordDecl *RD = dyn_cast_or_null<CXXRecordDecl>(*II)) {
> +      ClassTemplateDecl *CTD = RD->getDescribedClassTemplate();
> +
> +      if (!CTD) {
> +        if (CXXRecordDecl *Parent = dyn_cast<CXXRecordDecl>(RD->getParent()))

Is a single if enough here? Could there be more than one nesting level?

> +          CTD = Parent->getDescribedClassTemplate();
> +      }
> +
> +      bool IsClassTemplate = CTD != 0;
>        TemplateParamScopeStack.push_back(
>            new ParseScope(this, Scope::TemplateParamScope,
> -                        /*ManageScope*/IsClassTemplate));
> -      Actions.ActOnReenterTemplateScope(getCurScope(),
> -                                        MD->getDescribedClassTemplate());
> -      if (IsClassTemplate)
> +                        /*EnteredScope*/IsClassTemplate));
> +
> +      if (IsClassTemplate) {
> +        Actions.ActOnReenterTemplateScope(getCurScope(), CTD);
>          ++CurTemplateDepthTracker;
> +      }
>      }
>      TemplateParamScopeStack.push_back(new ParseScope(this, 
> Scope::DeclScope));
>      Actions.PushDeclContext(Actions.getCurScope(), *II);
> Index: test/Parser/DelayedTemplateParsing.cpp
> ===================================================================
> --- test/Parser/DelayedTemplateParsing.cpp
> +++ test/Parser/DelayedTemplateParsing.cpp
> @@ -123,3 +123,31 @@
>
>  template <typename T>
>  auto invalidTrailingRetType() -> Bogus {} // expected-error {{unknown type 
> name 'Bogus'}}
> +
> +namespace PR19613 {
> +
> +struct HeapTypeConfig {
> +  static void from_bitset();
> +};
> +
> +template <class Config>
> +struct TypeImpl  {
> +  struct BitsetType;
> +
> +  static void Any() {
> +    BitsetType::New();
> +  }
> +};
> +
> +template<class Config>
> +struct TypeImpl<Config>::BitsetType {
> +  static void New() {
> +    Config::from_bitset();
> +  }
> +};
> +
> +static void f() {
> +  TypeImpl<HeapTypeConfig>::Any();
> +}
> +
> +}
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to