1// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2
3namespace PR10622 {
4  struct foo {
5    const int first;
6    foo(const foo&) = default;
7  };
8  void find_or_insert(const foo& __obj) {
9    foo x(__obj);
10  }
11
12  struct bar : foo {
13    bar(const bar&) = default;
14  };
15  void test_bar(const bar &obj) {
16    bar obj2(obj);
17  }
18}
19
20namespace PR11418 {
21  template<typename T>
22  T may_throw() {
23    return T();
24  }
25
26  template<typename T> T &&declval() noexcept;
27
28  struct NonPOD {
29    NonPOD();
30    NonPOD(const NonPOD &) noexcept;
31    NonPOD(NonPOD &&) noexcept;
32  };
33
34  struct X {
35    NonPOD np = may_throw<NonPOD>();
36  };
37
38  static_assert(noexcept(declval<X>()), "noexcept isn't working at all");
39  static_assert(noexcept(X(declval<X&>())), "copy constructor can't throw");
40  static_assert(noexcept(X(declval<X>())), "move constructor can't throw");
41}
42