[PATCH] D19175: Fix for PR27015 (variable template initialized with a generic lambda expression)

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 26 13:55:01 PDT 2016


ahatanak added a comment.

I'm looking for a way to avoid the assert in Sema::PerformDependentDiagnostics that is fired when a template parameter doesn't have a name.

In order to avoid the assert, CXXRecordDecl::isDependentLambda() should return true for	the old lambda class, and in order to do that, somehow I have to set KnownDependent to true in Sema::ActOnStartOfLambdaDefinition when the lambda is used to initialize a variable template.

I can think of two ways to fix this:

1. Make changes in Sema::ActOnTypeParameter to call S->AddDecl(Param) regardless of whether Param has a name. This looks harmless to me because the list of Scope's decls is used just to see if a declaration belongs to a certain scope.

2. Add a field to Scope that indicates whether a variable template is being parsed.

Does this sound like a good idea or are there other ways to do what I'm trying to do?


http://reviews.llvm.org/D19175





More information about the cfe-commits mailing list