ObjCBoxedExpr can't be evaluated by the constant expression evaluator.
authorNick Lewycky <nicholas@mxc.ca>
Sat, 29 Apr 2017 00:07:27 +0000 (00:07 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Sat, 29 Apr 2017 00:07:27 +0000 (00:07 +0000)
commit19ae6dc853d3d4f867a6d1308f3c3fcca754a7a2
treeee057e33fb728e9315b7be34f7730dc87e866d3b
parent4346ae1a058c257bbd09e335e3a318d9e99fd2f1
ObjCBoxedExpr can't be evaluated by the constant expression evaluator.

A boxed expression evaluates its subexpr and then calls an objc method to transform it into another value with pointer type. The objc method can never be constexpr and therefore this expression can never be evaluated. Fixes a miscompile boxing expressions with side-effects.

Also make ObjCBoxedExpr handling a normal part of the expression evaluator instead of being the only case besides full-expression where we check for integer overflow.

llvm-svn: 301721
clang/lib/AST/ExprConstant.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaExprObjC.cpp
clang/test/CodeGenObjCXX/boxing.mm [new file with mode: 0644]