GCC: fix template specialization in ObjectContentHasher
GCC complains that explicit specialization in non-namespace scope is happening for ObjectContentHasher. In file included from ../../third_party/dawn/src/dawn_native/ShaderModule.cpp:19: ../../third_party/dawn/src/dawn_native/ObjectContentHasher.h:56:19: error: explicit specialization in non-namespace scope 'class dawn_native::ObjectContentHasher' 56 | template <> | ^ Additionally make RecordIterable constexpr, because it is called from constexpr methods. GCC complains about this as well: ../../third_party/dawn/src/dawn_native/ObjectContentHasher.h:76:50: error: call to non-'constexpr' function 'void dawn_native::ObjectContentHasher::RecordIterable(const IteratorT&) [with IteratorT = std::__cxx11::basic_string<char>]' 76 | recorder->RecordIterable<std::string>(str); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ Bug: None Change-Id: I535f5f5e0beded09f105f9871759b617c7384ae0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/35003 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Stephan Hartmann <stha09@googlemail.com>
This commit is contained in:
parent
61355d416d
commit
36cd254bbd
|
@ -53,13 +53,6 @@ namespace dawn_native {
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RecordImpl<std::string> {
|
||||
static constexpr void Call(ObjectContentHasher* recorder, const std::string& str) {
|
||||
recorder->RecordIterable<std::string>(str);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct RecordImpl<std::vector<T>> {
|
||||
static constexpr void Call(ObjectContentHasher* recorder, const std::vector<T>& vec) {
|
||||
|
@ -68,7 +61,7 @@ namespace dawn_native {
|
|||
};
|
||||
|
||||
template <typename IteratorT>
|
||||
void RecordIterable(const IteratorT& iterable) {
|
||||
constexpr void RecordIterable(const IteratorT& iterable) {
|
||||
for (auto it = iterable.begin(); it != iterable.end(); ++it) {
|
||||
Record(*it);
|
||||
}
|
||||
|
@ -76,6 +69,14 @@ namespace dawn_native {
|
|||
|
||||
size_t mContentHash = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ObjectContentHasher::RecordImpl<std::string> {
|
||||
static constexpr void Call(ObjectContentHasher* recorder, const std::string& str) {
|
||||
recorder->RecordIterable<std::string>(str);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
||||
#endif // DAWNNATIVE_OBJECT_CONTENT_HASHER_H_
|
Loading…
Reference in New Issue