blob: 81ca2ae0a20edfe2d099352e2517eade5b6522b4 [file] [log] [blame]
Richard Smith9ca5c422011-10-13 22:29:44 +00001// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
Douglas Gregord1cff772011-06-14 16:42:44 +00002
3// PR10087: Make sure that we don't conflate exception specifications
4// from different functions in the canonical type system.
5namespace std
6{
7
8template <class _Tp> _Tp&& declval() noexcept;
9
10template <class _Tp, class... _Args>
11struct __is_nothrow_constructible
12{
13 static const bool value = noexcept(_Tp(declval<_Args>()...));
14};
15
16template<class, class _Traits, class _Allocator>
17class basic_string
18{
19public:
20 typedef typename _Traits::char_type value_type;
21 typedef _Allocator allocator_type;
22
23 basic_string()
24 noexcept(__is_nothrow_constructible<allocator_type>::value);
25};
26
27template <class, class, class _Compare>
28struct __map_value_compare
29{
30public:
31 __map_value_compare()
32 noexcept(__is_nothrow_constructible<_Compare>::value);
33};
34
35struct less
36{
37};
38
39struct map
40{
41 typedef __map_value_compare<int, short, less> __vc;
42 __vc vc_;
43};
44
45
46template<class T, class _Traits, class _Allocator>
47basic_string<T, _Traits, _Allocator>::basic_string() noexcept(__is_nothrow_constructible<allocator_type>::value) {}
48
49template <class T, class Value, class _Compare>
50__map_value_compare<T, Value, _Compare>::__map_value_compare()
51 noexcept(__is_nothrow_constructible<_Compare>::value) {}
52
53} // std