aaron.ballman 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}}
 
----------------
ychen wrote:
> 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.
> 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.

I agree that the `1` is unused.

The trouble is that the diagnostic doesn't make that clear -- it just says the 
expression result is unused, which makes it sound like the entire comma 
expression result value is unused (which is not the case). I think the 
diagnostic should more clearly specify *what* is unused in this case, otherwise 
users may think the diagnostic is a false positive.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103938/new/

https://reviews.llvm.org/D103938

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to