Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //compile with g++ test.cpp -S -o - -masm=intel
- //then remove the `noexcept` keyword in `int f() noexcept;` and compile again
- //compare the two results
- #include <cstdio>
- int f() noexcept;
- struct s1 {
- ~s1();
- };
- struct s2 {
- ~s2();
- };
- struct s3 {
- ~s3();
- };
- int g(){
- s2 s2;
- return f()*f();
- }
- int test(){
- try {
- s1 s1;
- auto a = g();
- s3 s3;
- return a*g();
- }catch(int &e){
- std::printf("e: %d\n",e);
- throw;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement