Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct/class mismatch for char_traits #2561

Closed
mclow opened this issue Dec 4, 2018 · 3 comments
Closed

struct/class mismatch for char_traits #2561

mclow opened this issue Dec 4, 2018 · 3 comments
Assignees

Comments

@mclow
Copy link
Contributor

mclow commented Dec 4, 2018

in [iosfwd.syn], char_traits is declared as a class.

template<class charT> class char_traits;
template<> class char_traits<char>;
template<> class char_traits<char8_t>;
template<> class char_traits<char16_t>;
template<> class char_traits<char32_t>;
template<> class char_traits<wchar_t>;

In [char.traits.require] and [char.traits.specializations], they're defined as structs:
template<class charT> struct char_traits;
and

template<> struct char_traits<char>;
template<> struct char_traits<char8_t>;
template<> struct char_traits<char16_t>;
template<> struct char_traits<char32_t>;
template<> struct char_traits<wchar_t>;

Since everyone implements them as structs, I think that [iosfwd.syn] should be changed.

@jensmaurer jensmaurer self-assigned this Dec 7, 2018
@jensmaurer
Copy link
Member

Not that the difference would actually matter.

@mclow
Copy link
Contributor Author

mclow commented Dec 7, 2018

Actually, on at least one compiler (MSVC) it does matter, and clang will warn if you declare something as a class and then later define it as a struct if you use -Wmismatched-tags

@mclow
Copy link
Contributor Author

mclow commented Dec 7, 2018

Thanks for the prompt resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants