The InitializerList test had undefined behavior by creating a dangling pointer to the temporary initializer list. This patch removes the undefined behavior in the test by creating the initializer list directly.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
LGTM.
unittests/ADT/ArrayRefTest.cpp | ||
---|---|---|
150 ↗ | (On Diff #69282) | Why not turn it into a lambda so it stays local to the particular test that is using it? |
unittests/ADT/ArrayRefTest.cpp | ||
---|---|---|
150 ↗ | (On Diff #69282) | Good idea, New patch incoming. |
Switched test to a lambda. BTW, I don't have commit rights, so if this gets approved and someone would commit for me, I'd be very appreciative.
Thanks!
I'd probably just keep one of these two tests - they don't seem to add a lot separately. Probably just keep the "more realistic" version, I would think (but put it in the existing test).
But no big deal either way - just my 2c :)
I'd probably just keep one of these two tests - they don't seem to add a lot separately. Probably just keep the "more realistic" version, I would think (but put it in the existing test).
But no big deal either way - just my 2c :)
I actually just realized that the ArgTest12 tests exactly the 'realistic' test anyway. I've removed the realistic test, and left this as simply the fix for the UB.