PR c++/85553
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / noexcept10.C
blobb80228278b309ad81f21f3a8bbd9446313210de4
1 // PR c++/49082
2 // { dg-do compile { target c++11 } }
4 namespace std { template <class T> T&& declval() noexcept; }
6 struct Base
8   Base(const Base&) noexcept(false);
9   Base(Base&&) noexcept(false);
10  ~Base() noexcept(false);
13 struct Derived
14 : Base
16   // Derived(const Derived&) = default;
17   // Derived(Derived&&) = default;
20 static_assert(!noexcept(Base(std::declval<const Base&>())), "Error");
21 static_assert(!noexcept(Derived(std::declval<const Derived&>())), "Error"); // Error
23 static_assert(!noexcept(Base(std::declval<Base&&>())), "Error");
24 static_assert(!noexcept(Derived(std::declval<Derived&&>())), "Error"); // Error
26 static_assert(!noexcept(std::declval<Base&>().~Base()), "Error"); // OK
27 static_assert(!noexcept(std::declval<Derived&>().~Derived()), "Error"); // Error