canonical.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
  2. // expected-no-diagnostics
  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. template <class _Tp> _Tp&& declval() noexcept;
  8. template <class _Tp, class... _Args>
  9. struct _is_nothrow_constructible
  10. {
  11. static const bool value = noexcept(_Tp(declval<_Args>()...));
  12. };
  13. template<class, class _Traits, class _Allocator>
  14. class basic_string
  15. {
  16. public:
  17. typedef typename _Traits::char_type value_type;
  18. typedef _Allocator allocator_type;
  19. basic_string()
  20. noexcept(_is_nothrow_constructible<allocator_type>::value);
  21. };
  22. template <class, class, class _Compare>
  23. struct __map_value_compare
  24. {
  25. public:
  26. __map_value_compare()
  27. noexcept(_is_nothrow_constructible<_Compare>::value);
  28. };
  29. struct less
  30. {
  31. };
  32. struct map
  33. {
  34. typedef __map_value_compare<int, short, less> __vc;
  35. __vc vc_;
  36. };
  37. template<class T, class _Traits, class _Allocator>
  38. basic_string<T, _Traits, _Allocator>::basic_string() noexcept(_is_nothrow_constructible<allocator_type>::value) {}
  39. template <class T, class Value, class _Compare>
  40. __map_value_compare<T, Value, _Compare>::__map_value_compare()
  41. noexcept(_is_nothrow_constructible<_Compare>::value) {}
  42. } // std