This is an archive of the discontinued LLVM Phabricator instance.

PR10140 - StringPool's PooledStringPtr has non-const operator== causing bad OR-result
ClosedPublic

Authored by nikola on Jun 18 2014, 6:23 AM.

Details

Reviewers
dblaikie

Diff Detail

Event Timeline

nikola updated this revision to Diff 10562.Jun 18 2014, 6:23 AM
nikola retitled this revision from to PR10140 - StringPool's PooledStringPtr has non-const operator== causing bad OR-result.
nikola updated this object.
nikola edited the test plan for this revision. (Show Details)
nikola added a reviewer: chandlerc.
nikola added a subscriber: Unknown Object (MLST).

I suspect the primary bug here is that operator bool should be
explicit. Could you send a review for that too? (& verify that it
would've made the example given in PR10140 fail to compile, instead of
comparing booleans? (without the const patch applied))

In any case, I'll sign off on this change to add "const" - please go
ahead and commit.

nikola updated this revision to Diff 10596.Jun 18 2014, 5:11 PM
nikola edited reviewers, added: dblaikie; removed: chandlerc.
nikola removed a subscriber: dblaikie.

Tests fail with original code. Tests don't compile if only conversion operator is marked as explicit. Const qualifying comparison operators gets the tests to compile and pass.

dblaikie accepted this revision.Jun 18 2014, 5:19 PM
dblaikie edited edge metadata.

Oh, you don't need to create a separate class for the tests, just using "TEST(Grouping, Testname)" will work fine.

Please commit after you've made that change (removed "PooledStringPtrTest" class and changed from TEST_F to TEST macros).

Thanks for the work. For future reference I was suggesting that "adding explicit" could be done as a separate step, but it's fine together too. Thanks again.

This revision is now accepted and ready to land.Jun 18 2014, 5:19 PM

What file should I use, they all seem to be very specialized?

I thought you were talking about file, not class. Ignore me, I'm stupid :)

nikola closed this revision.Jun 18 2014, 5:35 PM

r211244. Thanks.