rsmith added a comment.

This will diagnose unused values in unreachable code in constant-evaluated 
contexts; that doesn't seem quite right. For example, in:

  void f() {
    new double[false ? (1, 2) : 3][false ? (1, 2) : 3];
  }

... we'll diagnose that the `1` is unused in only one of the two array bounds, 
because one of them is a constant-evaluated context and the other is not.

I'd suggest we start by adding a separate `DiagIfReachable` function that does 
the same thing as `DiagRuntimeBehavior` except without the context check, with 
the intent to eventually refine it to check for reachability even in 
expressions for which we don't build a CFG (eg, in the initializer of a global 
or in a constant expression).


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