diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2014-05-08 19:30:14 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2014-05-08 19:30:14 +0100 |
commit | 2735097a5595bdf06d9ac97275dfae82af3eb93d (patch) | |
tree | 87b9e0d9e6b0bfd9bb73b682c78cbdcf6a05ae16 /libstdc++-v3/include/std/fstream | |
parent | 2793eeab54e1969b2c5d5bebd89519048402e05b (diff) | |
download | gcc-2735097a5595bdf06d9ac97275dfae82af3eb93d.zip gcc-2735097a5595bdf06d9ac97275dfae82af3eb93d.tar.gz gcc-2735097a5595bdf06d9ac97275dfae82af3eb93d.tar.bz2 |
re PR libstdc++/13860 (Poor error messages on invalid template parameters for basic_filebuf)
PR libstdc++/13860
* include/std/fstream (basic_filebuf): Enforce requirements on traits.
From-SVN: r210231
Diffstat (limited to 'libstdc++-v3/include/std/fstream')
-rw-r--r-- | libstdc++-v3/include/std/fstream | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream index 17ccac6..51db21b 100644 --- a/libstdc++-v3/include/std/fstream +++ b/libstdc++-v3/include/std/fstream @@ -71,6 +71,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits> class basic_filebuf : public basic_streambuf<_CharT, _Traits> { +#if __cplusplus >= 201103L + template<typename _Tp> + using __chk_state = __and_<is_copy_assignable<_Tp>, + is_copy_constructible<_Tp>, + is_default_constructible<_Tp>>; + + static_assert(__chk_state<typename _Traits::state_type>::value, + "state_type must be CopyAssignable, CopyConstructible" + " and DefaultConstructible"); + + static_assert(is_same<typename _Traits::pos_type, + fpos<typename _Traits::state_type>>::value, + "pos_type must be fpos<state_type>"); +#endif public: // Types: typedef _CharT char_type; |