xref: /llvm-project/clang/test/CXX/special/class.dtor/p3.cpp (revision 66f3ac9d21978f378cb0d490d2935833c730f9ba)
11ee63527SRichard Smith // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -verify %s
21ee63527SRichard Smith 
31ee63527SRichard Smith // The exception specification of a destructor declaration is matched *before*
41ee63527SRichard Smith // the exception specification adjustment occurs.
51ee63527SRichard Smith namespace DR1492 {
61ee63527SRichard Smith   struct A { ~A(); }; // expected-note {{here}}
~A()7*66f3ac9dSRichard Smith   A::~A() noexcept {} // expected-warning {{previously declared with an implicit exception specification}}
81ee63527SRichard Smith 
91ee63527SRichard Smith   struct B { ~B() noexcept; }; // expected-note {{here}}
~B()10*66f3ac9dSRichard Smith   B::~B() {} // expected-warning {{previously declared with an explicit exception specification}}
111ee63527SRichard Smith 
121ee63527SRichard Smith   template<typename T> struct C {
131ee63527SRichard Smith     T t;
141ee63527SRichard Smith     ~C(); // expected-note {{here}}
151ee63527SRichard Smith   };
~C()161ee63527SRichard Smith   template<typename T> C<T>::~C() noexcept {} // expected-error {{does not match previous}}
171ee63527SRichard Smith }
18