p3.cpp revision 708f69bcc1be715efd1e9f46266a9c1ead184be6
140bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org// RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -verify %s
240bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org
340bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org// The exception specification of a destructor declaration is matched *before*
440bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org// the exception specification adjustment occurs.
540bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.orgnamespace DR1492 {
640bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org  struct A { ~A(); }; // expected-note {{here}}
740bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org  A::~A() noexcept {} // expected-error {{does not match previous declaration}}
840bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org
940bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org  struct B { ~B() noexcept; }; // expected-note {{here}}
1040bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org  B::~B() {} // expected-warning {{~B' is missing exception specification 'noexcept'}}
1140bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org
1240bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org  template<typename T> struct C {
1340bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org    T t;
1440bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org    ~C(); // expected-note {{here}}
1540bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org  };
1640bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org  template<typename T> C<T>::~C() noexcept {} // expected-error {{does not match previous}}
1740bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org}
1840bd7448cb81dea34512c6970864a710a75da666mikhal@webrtc.org