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