[PATCH] D103938: Diagnose -Wunused-value in constant evaluation context
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 8 18:37:03 PDT 2021
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
More information about the cfe-commits
mailing list