[PATCH] D136554: Implement CWG2631
Jordan Rupprecht via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 3 18:27:50 PST 2023
rupprecht added a comment.
In D136554#4024628 <https://reviews.llvm.org/D136554#4024628>, @rupprecht wrote:
> I still see one behavior change (actually it was there before, but I missed it in the test results), but as far as I can tell, it's a good one? If I reduce it too much, I get the warning with the baseline toolchain, so it's not erroneous AFAICT. Although I won't pretend I know all the intricacies of `static` and `inline`.
I missed another place in the unreduced repro that was referencing this method, and that was the trick. I reduced the newly-enabled warning case to this:
// a.h
static const std::pair<double, double>& GetFakePairRef() {
static constexpr std::pair<double, double> fake = {1.0, 2.0};
return fake;
}
struct Metadata {
const std::pair<double, double>& data = GetFakePairRef();
};
// main.cc, compiled with -Wunused-function
#include "a.h"
int main() { return 0; }
Again, still LGTM.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136554/new/
https://reviews.llvm.org/D136554
More information about the cfe-commits
mailing list