[PATCH] D50805: Don't warn on returning the address of a label from a statement expression

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 16 15:55:45 PDT 2018


rsmith added inline comments.


================
Comment at: clang/lib/Sema/SemaInit.cpp:6927-6928
       } else if (isa<AddrLabelExpr>(L)) {
-        Diag(DiagLoc, diag::warn_ret_addr_label) << DiagRange;
+        if (LK == LK_Return)
+          Diag(DiagLoc, diag::warn_ret_addr_label) << DiagRange;
       } else {
----------------
You should `return false;` if you don't produce a diagnostic here. If you carry on, you'll emit notes below and they'll get attached to whatever other diagnostic was produced most recently.


https://reviews.llvm.org/D50805





More information about the cfe-commits mailing list