faisalv added a comment.

I don't think this approach is entirely correct for at least the following 
reasons:

1. in the lambda case the machinery that diagnoses capture failures should be 
the machinery erroring on the lambda (when the parameter is odr-used)
2. in the unevaluated case, once you disable the error, the instantiation 
machinery will fail to find the corresponding instantiated parmvardecl.

I think - in addition to allowing unevaluated uses of parmvardecls by tweaking 
the DefaultArgumentChecker, you would also need to add the instantiated 
mappings of the parameters, prior to instantiating the default argument (to 
avoid the assertion) and perhaps need to tweak DoMarkVarDeclReferenced and/or 
tryCaptureVariable to make sure such cases for lambdas produce errors (if they 
don't, w the above fix).

Thanks for working on this!


https://reviews.llvm.org/D36915



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to