blob: d6dc258892050fff5a8d104776f5f36180552eff [file] [log] [blame]
Richard Smith9ca5c422011-10-13 22:29:44 +00001// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
Andy Gibbsc6e68da2012-10-19 12:44:48 +00002// expected-no-diagnostics
Douglas Gregord1cff772011-06-14 16:42:44 +00003
4// PR10087: Make sure that we don't conflate exception specifications
5// from different functions in the canonical type system.
6namespace std
7{
8
9template <class _Tp> _Tp&& declval() noexcept;
10
11template <class _Tp, class... _Args>
Alp Toker73287bf2014-01-20 00:24:09 +000012struct _is_nothrow_constructible
Douglas Gregord1cff772011-06-14 16:42:44 +000013{
14 static const bool value = noexcept(_Tp(declval<_Args>()...));
15};
16
17template<class, class _Traits, class _Allocator>
18class basic_string
19{
20public:
21 typedef typename _Traits::char_type value_type;
22 typedef _Allocator allocator_type;
23
24 basic_string()
Alp Toker73287bf2014-01-20 00:24:09 +000025 noexcept(_is_nothrow_constructible<allocator_type>::value);
Douglas Gregord1cff772011-06-14 16:42:44 +000026};
27
28template <class, class, class _Compare>
29struct __map_value_compare
30{
31public:
32 __map_value_compare()
Alp Toker73287bf2014-01-20 00:24:09 +000033 noexcept(_is_nothrow_constructible<_Compare>::value);
Douglas Gregord1cff772011-06-14 16:42:44 +000034};
35
36struct less
37{
38};
39
40struct map
41{
42 typedef __map_value_compare<int, short, less> __vc;
43 __vc vc_;
44};
45
46
47template<class T, class _Traits, class _Allocator>
Alp Toker73287bf2014-01-20 00:24:09 +000048basic_string<T, _Traits, _Allocator>::basic_string() noexcept(_is_nothrow_constructible<allocator_type>::value) {}
Douglas Gregord1cff772011-06-14 16:42:44 +000049
50template <class T, class Value, class _Compare>
51__map_value_compare<T, Value, _Compare>::__map_value_compare()
Alp Toker73287bf2014-01-20 00:24:09 +000052 noexcept(_is_nothrow_constructible<_Compare>::value) {}
Douglas Gregord1cff772011-06-14 16:42:44 +000053
54} // std