[PATCH] D103938: Diagnose -Wunused-value in constant evaluation context
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 15 07:44:14 PDT 2021
aaron.ballman added inline comments.
================
Comment at: clang/include/clang/Sema/Sema.h:5077
+ /// Conditionally issue a diagnostic based on the statements reachability
+ /// analysis evaluation context.
----------------
================
Comment at: clang/test/Sema/i-c-e.c:77-78
+ // expected-warning {{expression result unused}}
+int comma3[(1, 2)]; // expected-warning {{variable length array folded to constant array as an extension}} \
+ // expected-warning {{expression result unused}}
----------------
I think this diagnostic is kind of unfortunate because it increases my confusion -- the expression result is most assuredly *not* unused in these cases because it's used in the definition of the type.
================
Comment at: clang/test/SemaCXX/warn-unused-value.cpp:145
+namespace test5 {
+int v[(5, 6)]; // expected-warning {{expression result unused}}
+void foo() {
----------------
This is another one that tripped me up due to the diagnostic wording.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103938/new/
https://reviews.llvm.org/D103938
More information about the cfe-commits
mailing list