blob: 058a387d778ea6ca699004c4ad9ee99c35338852 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// PR c++/49082
// { dg-options -std=c++0x }
namespace std { template <class T> T&& declval() noexcept; }
struct Base
{
Base(const Base&) noexcept(false);
Base(Base&&) noexcept(false);
~Base() noexcept(false);
};
struct Derived
: Base
{
// Derived(const Derived&) = default;
// Derived(Derived&&) = default;
};
static_assert(!noexcept(Base(std::declval<const Base&>())), "Error");
static_assert(!noexcept(Derived(std::declval<const Derived&>())), "Error"); // Error
static_assert(!noexcept(Base(std::declval<Base&&>())), "Error");
static_assert(!noexcept(Derived(std::declval<Derived&&>())), "Error"); // Error
static_assert(!noexcept(std::declval<Base&>().~Base()), "Error"); // OK
static_assert(!noexcept(std::declval<Derived&>().~Derived()), "Error"); // Error
|