diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2018-02-01 03:55:27 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2018-02-01 03:55:27 +0000 |
commit | 1a6493b4e08c7789138b8087a44bcec53b9cd3fa (patch) | |
tree | 94ad40936e5f5f99d9575dda87e06e5f20d1516b /libcxx/include | |
parent | 7ce2b4cd137483995cd0e1de72a0a49e8703a597 (diff) | |
download | bcm5719-llvm-1a6493b4e08c7789138b8087a44bcec53b9cd3fa.tar.gz bcm5719-llvm-1a6493b4e08c7789138b8087a44bcec53b9cd3fa.zip |
Add static_asserts to basic_ios and basic_stream_buf to ensure that that the traits match the character type. This is a requirement on the user - now we get consistent failures at compile time instead of incomprehensible error messages or runtime failures. This is also LWG#2994 - not yet adopted.
llvm-svn: 323945
Diffstat (limited to 'libcxx/include')
-rw-r--r-- | libcxx/include/ios | 3 | ||||
-rw-r--r-- | libcxx/include/streambuf | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/libcxx/include/ios b/libcxx/include/ios index 61d00b90ee0..0bffa571e92 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -592,6 +592,9 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + static_assert((is_same<_CharT, typename traits_type::char_type>::value), + "traits_type::char_type must be the same type as CharT"); + // __true_value will generate undefined references when linking unless // we give it internal linkage. diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf index ea64f578045..e409d210607 100644 --- a/libcxx/include/streambuf +++ b/libcxx/include/streambuf @@ -132,6 +132,9 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + static_assert((is_same<_CharT, typename traits_type::char_type>::value), + "traits_type::char_type must be the same type as CharT"); + virtual ~basic_streambuf(); // 27.6.2.2.1 locales: |