Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s
      2 
      3 template <class T>
      4 T&&
      5 declval() noexcept;
      6 
      7 template <class T>
      8 struct some_trait
      9 {
     10     static const bool value = false;
     11 };
     12 
     13 template <class T>
     14 void swap(T& x, T& y) noexcept(some_trait<T>::value)
     15 {
     16     T tmp(static_cast<T&&>(x));
     17     x = static_cast<T&&>(y);
     18     y = static_cast<T&&>(tmp);
     19 }
     20 
     21 template <class T, unsigned N>
     22 struct array
     23 {
     24     T data[N];
     25 
     26   void swap(array& a) noexcept(noexcept(::swap(declval<T&>(), declval<T&>())));
     27 };
     28 
     29 struct DefaultOnly
     30 {
     31     DefaultOnly() = default;
     32     DefaultOnly(const DefaultOnly&) = delete;
     33     DefaultOnly& operator=(const DefaultOnly&) = delete;
     34     ~DefaultOnly() = default;
     35 };
     36 
     37 int main()
     38 {
     39     array<DefaultOnly, 1> a, b;
     40 }
     41 
     42