summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-01-10 14:35:05 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-01-10 14:35:05 +0100
commit629765804a9d416c022697c1d0ae9493127d3efe (patch)
treee88c321f67b16e4dff06de607d941d75ec36a18d /compilerplugins
parentad915fafd54f9115faea7147f82d80a942af2d68 (diff)
Work around problems with isCXX11ConstantExpr in template code
> template<size_t Size> > bool checkOutput(ScDocument* pDoc, const ScRange& aOutRange, const char* aOutputCheck[][Size], const char* pCaption) > { > ... > const char* p = aOutputCheck[nRow][nCol]; in sc/qa/unit/helper/qahelper.hxx caused > assert(E->isRValue() && E->getType()->hasPointerRepresentation()); in Clang's EvaluatePointer (lib/AST/ExprConstant.cpp) to fire. In the template definition itself, Clang doesn't introduce ArrayToPointerDecay ImplicitCastExpr into the subscripting operations (while in any implicit specializations that it instantiates, it does). This is interesting: Up to C++11, [expr.sub] requires the operator to have pointer type (so array-to-pointer decay is clearly asked for). In C++14 (CWG1213), the operator can also be of array type but it is not explicitly specified whether array-to-pointer decay is to be performed. In upcoming C++17 (P0135R1), it specifies further that an operator of array type must be a glvalue but still does not explicitly specify whether array-to-pointer decay is to be performed. Maybe the definition of the subscripting operation in terms of *((E1)+(E2)) is meant to imply that, however. Change-Id: I67c7b0f34002387dbf746288630371877c6261ef
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/conststringvar.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/compilerplugins/clang/conststringvar.cxx b/compilerplugins/clang/conststringvar.cxx
index 58a94e559428..a6d348a8d710 100644
--- a/compilerplugins/clang/conststringvar.cxx
+++ b/compilerplugins/clang/conststringvar.cxx
@@ -104,6 +104,10 @@ public:
if (init == nullptr) {
return true;
}
+ if (init->isInstantiationDependent()) {
+ // avoid problems with isCXX11ConstantExpr in template code
+ return true;
+ }
APValue v;
if (!init->isCXX11ConstantExpr(compiler.getASTContext(), &v)) {
return true;