aaron.ballman added inline comments.
================ Comment at: test/SemaCXX/warn-throw-out-noexcept-func.cpp:27 +} + +struct N : A { ---------------- jyu2 wrote: > aaron.ballman wrote: > > Can you add a test case like: > > ``` > > struct Throws { > > ~Throws() noexcept(false); > > }; > > > > struct ShouldDiagnose { > > Throws T; > > ~ShouldDiagnose() {} > > }; > > ``` > > I would expect `~ShouldDiagnose()` to be diagnosed as allowing exceptions > > to escape because of the destructor for `Throws`. > In C++11, destructors are implicitly throw() unless any member or base of the > type has a destructor with a different exception specification. > > In the case of: > struct Throws { > ~Throws() noexcept(false); > }; > > struct ShouldDiagnose { > Throws T; > ~ShouldDiagnose() {} > }; > > You should not see diagnose for ~ShouldDiagnose() , since ShouldDiagnose > has a member ofr Throws which has destructor with noexcept(false); therefor > ~ShouldDiagnose has noexcept(false). > > But I add test case which remove (false) part. Good point! A test case with `noexcept(false)` would be handy as would one where `~ShouldDiagnose()` is marked `noexcept(true)` explicitly rather than picking up the `noexcept(false)` implicitly. https://reviews.llvm.org/D33333 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits