meikeb added inline comments. ================ Comment at: lib/Sema/SemaChecking.cpp:4089-4090 @@ +4088,4 @@ + if (BinOp->isAdditiveOp()) { + bool LIsInt = BinOp->getLHS()->EvaluateAsInt(LResult, S.Context); + bool RIsInt = BinOp->getRHS()->EvaluateAsInt(RResult, S.Context); + ---------------- rsmith wrote: > What happens if one of these expressions is value-dependent? The evaluator > can crash or assert if given a value-dependent expression. If we don't defer > these checks in dependent contexts, you'll need to handle that possibility > somehow. > > Example: > > template<int N> void f(const char *p) { > printf("blah blah %s" + N, p); > } I think I don't understand what you are trying to tell me. Especially the example you provided does just fine and behaves as I expected. As far as I followed EvaluateAsInt it does not assert but returns false if we don't get a constexpr here. We warn under -Wformat-nonliteral for value-dependent string literals.
Could you explain this more or provide an example that triggers an assert or explain what behavior is wrong regarding the provided example? Thanks! https://reviews.llvm.org/D23820 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits