Skip to content

Commit d452f68

Browse files
committed
Remove constexpr-if from runtime
constexpr-if is a C++17 feature. Swift is C++14, so this results in a lot of warnings. Clang is smart enough that the constant propagation will elide the unused side of the branch anyway. Since we're doing a template check on a type, we should always have enough information at compile to elide. We would need a constexpr/std::enable_if-level approach if the API's were different to tell clang not to look at one side of the branch. That's not the case here so we can let the optimizer do it's thing and let clang look at both sides.
1 parent d1bb98b commit d452f68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/swift/Runtime/Concurrent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ struct ConcurrentReadableHashMap {
881881
auto *newElements = ElementStorage::allocate(newCapacity);
882882

883883
if (elements) {
884-
if constexpr (std::is_trivially_copyable<ElemTy>::value) {
884+
if (std::is_trivially_copyable<ElemTy>::value) {
885885
memcpy(newElements->data(), elements->data(),
886886
elementCount * sizeof(ElemTy));
887887
} else {

0 commit comments

Comments
 (0)