[PATCH] D28258: [Sema] Handle invalid noexcept expressions correctly.

Richard Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 3 15:25:59 PST 2017


rsmith added inline comments.


================
Comment at: lib/Parse/ParseDeclCXX.cpp:3547
       NoexceptRange = SourceRange(KeywordLoc, T.getCloseLocation());
-    } else {
-      NoexceptType = EST_None;
     }
   } else {
----------------
Should `NoexceptRange` be set in the `else` case too, now that we're claiming that the type is `EST_ComputedNoexcept`?


================
Comment at: lib/Sema/TreeTransform.h:5044-5057
+    if (!NoexceptExpr.isUsable())
       return true;
 
     // FIXME: This is bogus, a noexcept expression is not a condition.
     NoexceptExpr = getSema().CheckBooleanCondition(Loc, NoexceptExpr.get());
-    if (NoexceptExpr.isInvalid())
+    if (!NoexceptExpr.isUsable())
       return true;
----------------
These changes don't make sense to me: if we get a valid-but-null `ExprResult` from any of the above, there is no guarantee a diagnostic has been produced, so it is not correct to return `true`.

Which call is producing the valid-but-null `ExprResult`?


https://reviews.llvm.org/D28258





More information about the cfe-commits mailing list