This is an archive of the discontinued LLVM Phabricator instance.

[ADT] static_assert that SmallDenseMap is instantiated with a power-of-two number of inline buckets.
ClosedPublic

Authored by jlebar on Oct 23 2016, 10:56 AM.

Details

Summary

If you try to instantiate it with a non-power-of-two buckets, DenseMap
will assert at runtime (!) if we ever outgrow our inline storage.

I believe using a constexpr function inside of a static_assert is safe
now that we've unsupported MSVC 2013 and GCC < 4.8.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 75546.Oct 23 2016, 10:56 AM
jlebar retitled this revision from to [ADT] static_assert that SmallDenseMap is instantiated with a power-of-two number of inline buckets..
jlebar updated this object.
jlebar added reviewers: bkramer, qcolombet, escha.
jlebar added a subscriber: llvm-commits.
bkramer accepted this revision.Oct 24 2016, 5:14 AM
bkramer edited edge metadata.

This makes sense to me.

This revision is now accepted and ready to land.Oct 24 2016, 5:14 AM
This revision was automatically updated to reflect the committed changes.

Thank you for the review, Benjamin.