[PATCH] D36527: Implemented P0428R2 - Familiar template syntax for generic lambdas

Faisal Vali via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 19 11:44:24 PDT 2017


faisalv added inline comments.


================
Comment at: include/clang/Sema/ScopeInfo.h:774
+  /// \brief The number of parameters in the template parameter list that were
+  /// explicitely specified by the user, as opposed to being invented by use
+  /// of an auto parameter.
----------------
typo: explicitly


================
Comment at: lib/Parse/ParseExprCXX.cpp:1090
+  TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
+  Actions.RecordParsingTemplateParameterDepth(TemplateParameterDepth);
+
----------------
Since you only really need to pass this information on for computing the depth of the 'auto' parameters - why not just leave the RecordParsingTEmplateParameterDepth call where it was, increment the template depth once we parse the TPL, and just pass in the right depth (minus one if ExplicitTemplateParameters) and increment the tracker if we getGenericLambda but no explicit TPL?

I wonder if that might be the safer way to do it - especially if you have generic lambdas in default arguments of generic lambdas - each of which have explicit template parameters also??

thoughts?



================
Comment at: lib/Parse/ParseExprCXX.cpp:1113
+  // FIXME: Consider allowing this as an extension for GCC compatibiblity.
+  bool HasExplicitTemplateParams = getLangOpts().CPlusPlus2a
+                                   && Tok.is(tok::less);
----------------
make this const pls.


================
Comment at: lib/Parse/ParseExprCXX.cpp:1305
 
+  TemplateParamScope.Exit();
+
----------------
Why do you exit the scope here, and then re-add the template parameters to the current scope?  What confusion (if any) occurs if you leave this scope on?



https://reviews.llvm.org/D36527





More information about the cfe-commits mailing list