Guest User

Untitled

a guest
Mar 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. class X
  4. {
  5. public:
  6. X() = default;
  7. virtual ~X() = default;
  8. virtual void Test()
  9. {
  10. std::cout << __PRETTY_FUNCTION__ << std::endl;
  11. }
  12. };
  13.  
  14. int main()
  15. {
  16. X x;
  17.  
  18. // This will not fire even in GCC 4.7.2 if the destructor is
  19. // explicitly marked as noexcept(true)
  20. // default destructor is automatically generated with noexcept keyword.
  21. static_assert(noexcept(x.~X()), "Ouch!");
  22.  
  23. // it is fired.
  24. //static_assert(noexcept(x.Test()), "Oops!");
  25. }
Add Comment
Please, Sign In to add comment