tuple_element is declared as a struct but in the standard library headers it's a class
vlovich opened this issue · 6 comments
This results in a compilation warning. https://en.cppreference.com/w/cpp/utility/tuple/tuple_element lists it as a class too. Needs to be changed to class + the forward-declaration in non-C++11 mode.
C++14 and C++20 drafts show this:
// 23.4.4, tuple-like access to pair
template<size_t I, class T> class tuple_element;
template<size_t I, class T1, class T2> struct tuple_element<I, pair<T1, T2>>;
Is it allowed for a template specialization to be struct
whereas the base template is class
, or would that be an editorial mistake?
Same problem appears for tuple_size btw but this does appear to vary by toolchain. libstdc++ & MSVC use struct, libc++ uses class. Unless you want to support arbitrary versions, I think #pragma GCC system_header
and #pragma clang system_header
directives might be useful to aid integration rather than trying to match class/struct.
Perhaps adding -Wall to your build might help surface some of these integration issues?
As far as i can see, only clang produces this warning and "AFAICS, this warning is wrong and the clang developers should remove it."
So I'm inclined to add -Wno-mismatched-tags
to the build span.hpp
.
@vlovich Can I close this issue?
Yup