I don't think this patch does the right thing: in your first example it makes 
the `ParenListExpr` for `(1)` have non-dependent type `void` and not be 
value-dependent. Then we'll try evaluating it inside the lambda, and evaluation 
will fail (because it doesn't make sense to evaluate a `ParenListExpr`), and 
we'll conclude that the initializer for `l` can never be constant. I think if 
you remove the `static` from that example, you'll reject valid (because you'll 
incorrectly conclude that `l` is captured but cannot be).

  I committed a different fix for the original issue in r200954, but I think 
this is still worth dealing with. It's not good to have non-value-dependent 
expressions that we can't actually evaluate, but I think the right approach 
here is to make the initializer expression value-dependent in this case, not to 
make it 'void'.


================
Comment at: lib/Sema/SemaExpr.cpp:5250
@@ -5249,2 +5249,3 @@
   Expr *expr = new (Context) ParenListExpr(Context, L, Val, R);
+  expr->setType(Context.VoidTy); // FIXME: just a place holder for now.
   return Owned(expr);
----------------
How about doing this slightly differently: in 
`InitializationSequence::Perform`, when we rebuild a dependent sequence, pass 
the type of the initialized object to the created `ParenListExpr` or 
`InitListExpr` (if any), and set the object to be type-, value- and 
instantiation-dependent if said type is dependent. Then, use `VoidTy` as the 
type in the case where we aren't creating the `ParenListExpr` from a dependent 
initialization sequence.


http://llvm-reviews.chandlerc.com/D2575
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to