Skip to content

Unspecialized class template error and my solution #254

@chrysantd

Description

@chrysantd

I am using VS 2017 and Windows 10 64 bit.

I got a lot of erros when compiling my code. All the erros is like below:

Error C3203 'SharedBitfield': unspecialized class template can't be used as a template argument for template parameter '', expected a real type
c:\users\chry\documents\glbinding\include\glbinding\sharedbitfield.inl 44

Error C2244 'glbinding::SharedBitfield::|': unable to match function definition to an existing declaration normal_estimation_test c:\users\chry\documents\glbinding\include\glbinding\sharedbitfield.inl 45

and the error code is like below:

template <typename Type>
template <typename... T>
GLBINDING_CONSTEXPR auto SharedBitfield<Type>::operator|(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type
{
return typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type(this->m_value | static_cast<decltype(this->m_value)>(other));
}

If I get what you mean here, changing to below code can solve the error:

template <typename Type>
template <typename... T>
GLBINDING_CONSTEXPR auto SharedBitfield<Type>::operator|(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield<Type>, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield<Type>, SharedBitfield<T...>>::type>::type
{
return typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type(this->m_value | static_cast<decltype(this->m_value)>(other));
}

I dont know if original code can be passed in other platforms. But in vs 2017, it seems unspecialized class template like SharedBitfield can not used directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions