================
@@ -5721,6 +5721,10 @@ Parser::DeclGroupPtrTy Parser::ParseTopLevelStmtDecl() {
       Tok.getAnnotationValue() != nullptr) {
     ConsumeAnnotationToken();
     TLSD->setSemiMissing();
+  } else if (R.isUsable()) {
+    // Semicolon is present, so the value is being discarded.
+    // Re-diagnose [[nodiscard]] warnings that were suppressed during parsing.
+    Actions.DiagnoseUnusedExprResult(R.get(), diag::warn_unused_expr);
----------------
vgvassilev wrote:

Nominally we should not need this branch -- we explicitly suppress it here:

https://github.com/llvm/llvm-project/blob/84c66f4f0d2917fbf21f8a37718b9cbe56a19db1/clang/lib/Interpreter/Interpreter.cpp#L468-L471

Can we adjust the logic there instead of touching this file?

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

Reply via email to