[PATCH] D103938: Diagnose -Wunused-value in constant evaluation context

Yuanfang Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 21 10:36:51 PDT 2021


ychen added inline comments.


================
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}}
 
----------------
aaron.ballman wrote:
> 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.
> the expression result is most assuredly *not* unused in these cases because it's used in the definition of the type.
 
Do you mean "1" is used in the definition of the type? The warning is for "1" in this case. If I change `1` to any other number, the type of `comma3` should not change, I think that means `1` is not used.


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