xref: /aosp_15_r20/external/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <fstream>
11 
12 // template <class charT, class traits = char_traits<charT> >
13 // class basic_fstream
14 
15 // The char type of the stream and the char_type of the traits have to match
16 
17 #include <fstream>
18 
main()19 int main()
20 {
21 	std::basic_fstream<char, std::char_traits<wchar_t> > f;
22 //  expected-error-re@ios:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}}
23 //  expected-error-re@streambuf:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}}
24 
25 // FIXME: As of commit r324062 Clang incorrectly generates a diagnostic about mismatching
26 // exception specifications for types which are already invalid for one reason or another.
27 // For now we tolerate this diagnostic.
28 // expected-error@ostream:* 0-1 {{exception specification of overriding function is more lax than base version}}
29 }
30 
31