Remove storage class specifier for the explicit template specialization

According to the http://www.eel.is/c++draft/temp.expl.spec:
An explicit specialization shall not use a storage-class-specifier
other than thread_local.
Clang doesn't claims about it, but GCC does.
An error example for GCC 8.4.0:
gen/third_party/dawn/src/dawn_wire/client/ApiObjects_autogen.h:25:5:
error: explicit template specialization cannot have a storage class

Bug: dawn:384
Change-Id: Iaf86722a943d19c9796a7f112885666ac88f20ca
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33480
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Ivan Murashov 2020-11-20 09:38:56 +00:00 committed by Commit Bot service account
parent b6e141afb8
commit 75a1f5234e
2 changed files with 7 additions and 3 deletions

View File

@ -21,7 +21,9 @@
namespace dawn_wire { namespace client { namespace dawn_wire { namespace client {
template <typename T> template <typename T>
static constexpr ObjectType ObjectTypeToTypeEnum = static_cast<ObjectType>(-1); struct ObjectTypeToTypeEnum {
static constexpr ObjectType value = static_cast<ObjectType>(-1);
};
{% for type in by_category["object"] %} {% for type in by_category["object"] %}
{% set Type = type.name.CamelCase() %} {% set Type = type.name.CamelCase() %}
@ -41,7 +43,9 @@ namespace dawn_wire { namespace client {
} }
template <> template <>
static constexpr ObjectType ObjectTypeToTypeEnum<{{type.name.CamelCase()}}> = ObjectType::{{type.name.CamelCase()}}; struct ObjectTypeToTypeEnum<{{Type}}> {
static constexpr ObjectType value = ObjectType::{{Type}};
};
{% endfor %} {% endfor %}
}} // namespace dawn_wire::client }} // namespace dawn_wire::client

View File

@ -65,7 +65,7 @@ namespace dawn_wire { namespace client {
template <typename T> template <typename T>
void TrackObject(T* object) { void TrackObject(T* object) {
mObjects[ObjectTypeToTypeEnum<T>].Append(object); mObjects[ObjectTypeToTypeEnum<T>::value].Append(object);
} }
void CancelCallbacksForDisconnect() override; void CancelCallbacksForDisconnect() override;