Skip to content

Commit

Permalink
SmallVector.h: avoid casting away constness
Browse files Browse the repository at this point in the history
Casting to `void*` removes constness if `T` is a `const` type. Even though the casting here is safe (i.e., no modifications are made), some compilers warn about the cast anway. Avoid casting away constness to remove some picky compiler warnings.
  • Loading branch information
tdp2110 authored Sep 13, 2023
1 parent 46e68f7 commit cec64c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/slang/util/SmallVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ class SmallVectorBase {

/// Indicates whether we are still "small", which means we are still on the stack.
[[nodiscard]] constexpr bool isSmall() const noexcept {
return (void*)data_ == (void*)firstElement;
return (const void*)data_ == (const void*)firstElement;
}

protected:
Expand Down

0 comments on commit cec64c2

Please sign in to comment.