Richard Smith | 9ca5c42 | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
Andy Gibbs | c6e68da | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Douglas Gregor | d1cff77 | 2011-06-14 16:42:44 +0000 | [diff] [blame] | 3 | |
| 4 | // PR10087: Make sure that we don't conflate exception specifications |
| 5 | // from different functions in the canonical type system. |
| 6 | namespace std |
| 7 | { |
| 8 | |
| 9 | template <class _Tp> _Tp&& declval() noexcept; |
| 10 | |
| 11 | template <class _Tp, class... _Args> |
Alp Toker | 73287bf | 2014-01-20 00:24:09 +0000 | [diff] [blame] | 12 | struct _is_nothrow_constructible |
Douglas Gregor | d1cff77 | 2011-06-14 16:42:44 +0000 | [diff] [blame] | 13 | { |
| 14 | static const bool value = noexcept(_Tp(declval<_Args>()...)); |
| 15 | }; |
| 16 | |
| 17 | template<class, class _Traits, class _Allocator> |
| 18 | class basic_string |
| 19 | { |
| 20 | public: |
| 21 | typedef typename _Traits::char_type value_type; |
| 22 | typedef _Allocator allocator_type; |
| 23 | |
| 24 | basic_string() |
Alp Toker | 73287bf | 2014-01-20 00:24:09 +0000 | [diff] [blame] | 25 | noexcept(_is_nothrow_constructible<allocator_type>::value); |
Douglas Gregor | d1cff77 | 2011-06-14 16:42:44 +0000 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | template <class, class, class _Compare> |
| 29 | struct __map_value_compare |
| 30 | { |
| 31 | public: |
| 32 | __map_value_compare() |
Alp Toker | 73287bf | 2014-01-20 00:24:09 +0000 | [diff] [blame] | 33 | noexcept(_is_nothrow_constructible<_Compare>::value); |
Douglas Gregor | d1cff77 | 2011-06-14 16:42:44 +0000 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | struct less |
| 37 | { |
| 38 | }; |
| 39 | |
| 40 | struct map |
| 41 | { |
| 42 | typedef __map_value_compare<int, short, less> __vc; |
| 43 | __vc vc_; |
| 44 | }; |
| 45 | |
| 46 | |
| 47 | template<class T, class _Traits, class _Allocator> |
Alp Toker | 73287bf | 2014-01-20 00:24:09 +0000 | [diff] [blame] | 48 | basic_string<T, _Traits, _Allocator>::basic_string() noexcept(_is_nothrow_constructible<allocator_type>::value) {} |
Douglas Gregor | d1cff77 | 2011-06-14 16:42:44 +0000 | [diff] [blame] | 49 | |
| 50 | template <class T, class Value, class _Compare> |
| 51 | __map_value_compare<T, Value, _Compare>::__map_value_compare() |
Alp Toker | 73287bf | 2014-01-20 00:24:09 +0000 | [diff] [blame] | 52 | noexcept(_is_nothrow_constructible<_Compare>::value) {} |
Douglas Gregor | d1cff77 | 2011-06-14 16:42:44 +0000 | [diff] [blame] | 53 | |
| 54 | } // std |