rsmith added a comment.
We stand no hope of being bug-for-bug compatible with MSVC's constant
expression evaluator -- we should assume there will be expressions that we
evaluate as a constant and they do not, and vice versa. For reference, we have
the same problem between code built by Clang an
rnk added a comment.
Richard really is the constexpr owner so I'd like him to chime in if he can.
Comment at: include/clang/AST/Decl.h:1092
@@ -1091,3 +1091,3 @@
/// succeeded, 0 otherwise.
- APValue *evaluateValue() const;
- APValue *evaluateValue(SmallVectorImpl &Notes) c
ehsan updated this revision to Diff 47021.
ehsan added a comment.
Addressed the review comments.
http://reviews.llvm.org/D16465
Files:
include/clang/AST/Decl.h
include/clang/AST/Expr.h
include/clang/Basic/DiagnosticASTKinds.td
lib/AST/Decl.cpp
lib/AST/ExprConstant.cpp
lib/CodeGen/CG
ehsan added a comment.
In http://reviews.llvm.org/D16465#333688, @rnk wrote:
> Your code won't catch this test case:
>
> static int x;
> extern inline const bool *f() {
> static const bool p = !&x;
> return &p;
> }
>
> Getting this exactly right is going to be a challenge. =/
Oh y
rnk added a comment.
Your code won't catch this test case:
static int x;
extern inline const bool *f() {
static const bool p = !&x;
return &p;
}
Getting this exactly right is going to be a challenge. =/
Comment at: include/clang/Basic/DiagnosticASTKinds.td:151
@@
majnemer added a subscriber: majnemer.
majnemer added a comment.
Adding @rsmith as a reviewer.
http://reviews.llvm.org/D16465
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
ehsan added inline comments.
Comment at: lib/AST/ExprConstant.cpp:4113
@@ +4112,3 @@
+ if (!CheckPotentialExpressionContainingDeclRefExpr(E->getTrueExpr(),
+ E->getFalseExpr()))
+return false;
O
ehsan created this revision.
ehsan added a reviewer: rnk.
ehsan added a subscriber: cfe-commits.
In the Microsoft ABI, some expressions containing references to variables
cannot be evaluated as a constant. These are expressions containing a
conditional, logical and/or, or comma operator with an o