[PATCH] D34331: func.wrap.func.con: Unset function before destroying anything
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 9 03:57:11 PDT 2017
arphaman added a comment.
If you look at the AST diff between C++11 and C++03 this error still happens because of how `nullptr` is processed:
C++11:
| |-CXXDestructorDecl 0x7fdab27a2498 <line:24:3, line:28:3> line:24:3 used ~A 'void (void) noexcept'
| | `-CompoundStmt 0x7fdab27bcfb8 <col:8, line:28:3>
| | |-GCCAsmStmt 0x7fdab27a2670 <line:25:5, col:11>
| | `-IfStmt 0x7fdab27bcf88 <line:26:5, line:27:16>
| | |-<<<NULL>>>
| | |-ImplicitCastExpr 0x7fdab27a26e0 <line:26:9> '_Bool' <LValueToRValue>
| | | `-DeclRefExpr 0x7fdab27a26b8 <col:9> '_Bool' lvalue Var 0x7fdab27a23b8 'cancel' '_Bool'
| | |-CXXOperatorCallExpr 0x7fdab27bcf40 <line:27:7, col:16> 'class std::__1::function<void (void)>' lvalue
| | | |-ImplicitCastExpr 0x7fdab27bcf28 <col:14> 'class std::__1::function<void (void)> &(*)(nullptr_t) noexcept' <FunctionToPointerDecay>
| | | | `-DeclRefExpr 0x7fdab27bcea0 <col:14> 'class std::__1::function<void (void)> &(nullptr_t) noexcept' lvalue CXXMethod 0x7fdab27ab010 'operator=' 'class std::__1::function<void (void)> &(nullptr_t) noexcept'
| | | |-DeclRefExpr 0x7fdab27a26f8 <col:7> 'std::function<void (void)>':'class std::__1::function<void (void)>' lvalue Var 0x7fdab27a2348 'global' 'std::function<void (void)>':'class std::__1::function<void (void)>'
| | | `-CXXNullPtrLiteralExpr 0x7fdab27a2720 <col:16> 'nullptr_t'
| | `-<<<NULL>>>
vs C++03:
| |-CXXDestructorDecl 0x7fc72b6d80d8 <line:24:3, line:28:3> line:24:3 used ~A 'void (void)'
| | `-CompoundStmt 0x7fc72b6dfd88 <col:8, line:28:3>
| | |-GCCAsmStmt 0x7fc72b6d82a0 <line:25:5, col:11>
| | `-IfStmt 0x7fc72b6dfd58 <line:26:5, /Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__nullptr:49:40>
| | |-<<<NULL>>>
| | |-ImplicitCastExpr 0x7fc72b6d8310 </Users/buildslave/jenkins/libcxx-build/libcxx.src/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp:26:9> '_Bool' <LValueToRValue>
| | | `-DeclRefExpr 0x7fc72b6d82e8 <col:9> '_Bool' lvalue Var 0x7fc72b6d8028 'cancel' '_Bool'
| | |-CXXOperatorCallExpr 0x7fc72b6dfd10 <line:27:7, /Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__nullptr:49:40> 'class std::__1::function<void (void)>' lvalue
| | | |-ImplicitCastExpr 0x7fc72b6dfcf8 </Users/buildslave/jenkins/libcxx-build/libcxx.src/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp:27:14> 'class std::__1::function<void (void)> &(*)(struct std::__1::nullptr_t)' <FunctionToPointerDecay>
| | | | `-DeclRefExpr 0x7fc72b6dfca0 <col:14> 'class std::__1::function<void (void)> &(struct std::__1::nullptr_t)' lvalue CXXMethod 0x7fc72b6daea0 'operator=' 'class std::__1::function<void (void)> &(struct std::__1::nullptr_t)'
| | | |-DeclRefExpr 0x7fc72b6d8328 <col:7> 'std::function<void (void)>':'class std::__1::function<void (void)>' lvalue Var 0x7fc72b6d7fb8 'global' 'std::function<void (void)>':'class std::__1::function<void (void)>'
| | | `-CXXConstructExpr 0x7fc72b6dfc68 </Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__config:441:15, /Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__nullptr:49:40> 'struct std::__1::nullptr_t' 'void (const struct std::__1::nullptr_t &) throw()' elidable
| | | `-MaterializeTemporaryExpr 0x7fc72b6dfc50 </Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__config:441:15, /Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__nullptr:49:40> 'const struct std::__1::nullptr_t' lvalue
| | | `-ImplicitCastExpr 0x7fc72b6dfc38 </Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__config:441:15, /Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__nullptr:49:40> 'const struct std::__1::nullptr_t' <NoOp>
| | | `-CallExpr 0x7fc72b6d83d0 </Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__config:441:15, /Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__nullptr:49:40> 'struct std::__1::nullptr_t'
| | | `-ImplicitCastExpr 0x7fc72b6d83b8 </Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__config:441:15, /Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__nullptr:49:24> 'struct std::__1::nullptr_t (*)(void)' <FunctionToPointerDecay>
| | | `-DeclRefExpr 0x7fc72b6d8380 </Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__config:441:15, /Users/buildslave/jenkins/libcxx-build/libcxx.src/include/__nullptr:49:24> 'struct std::__1::nullptr_t (void)' lvalue Function 0x7fc72b08d340 '__get_nullptr_t' 'struct std::__1::nullptr_t (void)'
| | `-<<<NULL>>>
https://reviews.llvm.org/D34331
More information about the cfe-commits
mailing list