19ca5c425SRichard Smith // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s 2*c6e68daaSAndy Gibbs // expected-no-diagnostics 35c076db1SDouglas Gregor 45c076db1SDouglas Gregor namespace PR10622 { 55c076db1SDouglas Gregor struct foo { 65c076db1SDouglas Gregor const int first; 75c076db1SDouglas Gregor foo(const foo&) = default; 85c076db1SDouglas Gregor }; find_or_insert(const foo & __obj)95c076db1SDouglas Gregor void find_or_insert(const foo& __obj) { 105c076db1SDouglas Gregor foo x(__obj); 115c076db1SDouglas Gregor } 129996c8feSDouglas Gregor 139996c8feSDouglas Gregor struct bar : foo { 149996c8feSDouglas Gregor bar(const bar&) = default; 159996c8feSDouglas Gregor }; test_bar(const bar & obj)169996c8feSDouglas Gregor void test_bar(const bar &obj) { 179996c8feSDouglas Gregor bar obj2(obj); 189996c8feSDouglas Gregor } 195c076db1SDouglas Gregor } 207db3e95bSDouglas Gregor 217db3e95bSDouglas Gregor namespace PR11418 { 227db3e95bSDouglas Gregor template<typename T> may_throw()237db3e95bSDouglas Gregor T may_throw() { 247db3e95bSDouglas Gregor return T(); 257db3e95bSDouglas Gregor } 267db3e95bSDouglas Gregor 277db3e95bSDouglas Gregor template<typename T> T &&declval() noexcept; 287db3e95bSDouglas Gregor 297db3e95bSDouglas Gregor struct NonPOD { 307db3e95bSDouglas Gregor NonPOD(); 317db3e95bSDouglas Gregor NonPOD(const NonPOD &) noexcept; 327db3e95bSDouglas Gregor NonPOD(NonPOD &&) noexcept; 337db3e95bSDouglas Gregor }; 347db3e95bSDouglas Gregor 357db3e95bSDouglas Gregor struct X { 367db3e95bSDouglas Gregor NonPOD np = may_throw<NonPOD>(); 377db3e95bSDouglas Gregor }; 387db3e95bSDouglas Gregor 397db3e95bSDouglas Gregor static_assert(noexcept(declval<X>()), "noexcept isn't working at all"); 407db3e95bSDouglas Gregor static_assert(noexcept(X(declval<X&>())), "copy constructor can't throw"); 417db3e95bSDouglas Gregor static_assert(noexcept(X(declval<X>())), "move constructor can't throw"); 427db3e95bSDouglas Gregor } 43