faisalv added inline comments.
================
Comment at: lib/Sema/SemaLambda.cpp:858
+ KnownDependent = CurScope->getTemplateParamParent() != nullptr;
+ }
----------------
hamzasood wrote:
> faisalv wrote:
> > Hmm - now that you drew my attention to this ;) - I'm pretty sure this is
> > broken - but (embarrassingly) it broke back when i implemented generic
> > lambdas (and interestingly is less broken w generic lambdas w explicit
> > TPLs) - could I ask you to add a FIXME here that states something along the
> > lines of:
> >
> > When parsing default arguments that contain lambdas, it seems necessary to
> > know whether the containing parameter-declaration clause is that of a
> > template to mark the closure type created in the default-argument as
> > dependent. Using template params to detect dependence is not enough for
> > all generic lambdas since you can have generic lambdas without explicit
> > template parameters, and whose default arguments contain lambdas that
> > should be dependent - and you can not rely on the existence of a template
> > parameter scope to detect those cases. Consider:
> > auto L = [](int I = [] { return 5; }(), auto a) { };
> > The above nested closure type (of the default argument) occurs within a
> > dependent context and is therefore dependent - but we won't know that until
> > we parse the second parameter.
> >
> > p.s. I'll try and get around to fixing this if no one else does.
> >
> Good point. Now you mention it, isn't it even more broken than than?
> E.g:
>
> ```
> auto L = [](auto A, int I = [] { return 5; }());
> ```
>
> L is known to be generic before we parse the nested lambda, but template
> param scopes aren't established for auto parameters (I think), so the nested
> lambda won't get marked as dependent
I was aware of that - but I think that's the easier case to fix (where you see
the auto first - hence i reversed it in my example).
https://reviews.llvm.org/D36527
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits