================
@@ -10055,7 +10055,11 @@ QualType Sema::getDecltypeForExpr(Expr *E) {
   //   access to a corresponding data member of the closure type that
   //   would have been declared if x were an odr-use of the denoted
   //   entity.
-  if (getCurLambda() && isa<ParenExpr>(IDExpr)) {
+
+  // decltype result for blocks should be the same as decltype result in 
+  // lambdas because blocks capture variables the same as lambdas do
+  // https://github.com/llvm/llvm-project/issues/207355#issuecomment-4877181419
+  if (isa<ParenExpr>(IDExpr)) {
----------------
ahatanak wrote:

The guard changed from `getCurLambda() && isa<ParenExpr>(IDExpr)` to just 
`isa<ParenExpr>(IDExpr)`, not to something block specific. That means any 
capturing contexts, including OpenMP captured regions, etc., go through this 
code now too.

Should we update the description to say the fix generalizes the rule to 
capturing contexts broadly, not just blocks specifically? It looks like block 
is the only context where this actually changes behavior, but please verify 
that yourself.

https://github.com/llvm/llvm-project/pull/207583
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to