Richard Smith | 9ca5c42 | 2011-10-13 22:29:44 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
Douglas Gregor | d1cff77 | 2011-06-14 16:42:44 +0000 | [diff] [blame] | 2 | |
| 3 | // PR10087: Make sure that we don't conflate exception specifications |
| 4 | // from different functions in the canonical type system. |
| 5 | namespace std |
| 6 | { |
| 7 | |
| 8 | template <class _Tp> _Tp&& declval() noexcept; |
| 9 | |
| 10 | template <class _Tp, class... _Args> |
| 11 | struct __is_nothrow_constructible |
| 12 | { |
| 13 | static const bool value = noexcept(_Tp(declval<_Args>()...)); |
| 14 | }; |
| 15 | |
| 16 | template<class, class _Traits, class _Allocator> |
| 17 | class basic_string |
| 18 | { |
| 19 | public: |
| 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 | |
| 27 | template <class, class, class _Compare> |
| 28 | struct __map_value_compare |
| 29 | { |
| 30 | public: |
| 31 | __map_value_compare() |
| 32 | noexcept(__is_nothrow_constructible<_Compare>::value); |
| 33 | }; |
| 34 | |
| 35 | struct less |
| 36 | { |
| 37 | }; |
| 38 | |
| 39 | struct map |
| 40 | { |
| 41 | typedef __map_value_compare<int, short, less> __vc; |
| 42 | __vc vc_; |
| 43 | }; |
| 44 | |
| 45 | |
| 46 | template<class T, class _Traits, class _Allocator> |
| 47 | basic_string<T, _Traits, _Allocator>::basic_string() noexcept(__is_nothrow_constructible<allocator_type>::value) {} |
| 48 | |
| 49 | template <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 |