diff options
-rw-r--r-- | clang/test/Index/evaluate-cursor.cpp | 11 | ||||
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Index/evaluate-cursor.cpp b/clang/test/Index/evaluate-cursor.cpp index 39fc9db98a3..af396318aab 100644 --- a/clang/test/Index/evaluate-cursor.cpp +++ b/clang/test/Index/evaluate-cursor.cpp @@ -21,6 +21,11 @@ unsigned long long HUGE = 1ull << 63; long long HUGE_NEG = -(1ll << 35); +template <typename d> class e { + using f = d; + static const auto g = alignof(f); +}; + // RUN: c-index-test -evaluate-cursor-at=%s:4:7 \ // RUN: -evaluate-cursor-at=%s:8:7 \ // RUN: -evaluate-cursor-at=%s:8:11 -std=c++11 %s | FileCheck %s @@ -42,3 +47,9 @@ long long HUGE_NEG = -(1ll << 35); // CHECK-LONG: unsigned, Value: 1152921504606846976 // CHECK-LONG: unsigned, Value: 9223372036854775808 // CHECK-LONG: Value: -34359738368 + +// RUN: c-index-test -evaluate-cursor-at=%s:18:20 \ +// RUN: -evaluate-cursor-at=%s:20:20 \ +// RUN: -evaluate-cursor-at=%s:26:21 \ +// RUN: -std=c++11 %s | FileCheck -check-prefix=CHECK-DOES-NOT-CRASH %s +// CHECK-DOES-NOT-CRASH: Not Evaluatable diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index b3d2974b43b..17c40615335 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -3782,6 +3782,8 @@ static const ExprEvalResult* evaluateExpr(Expr *expr, CXCursor C) { return nullptr; expr = expr->IgnoreParens(); + if (expr->isValueDependent()) + return nullptr; if (!expr->EvaluateAsRValue(ER, ctx)) return nullptr; |