summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp2
-rw-r--r--clang/test/Analysis/virtualcall.cpp21
2 files changed, 22 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
index ea1976e0202..c5010f53785 100644
--- a/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
@@ -146,7 +146,7 @@ static bool isVirtualCall(const CallExpr *CE) {
if (CME->getQualifier())
CallIsNonVirtual = true;
- if (const Expr *Base = CME->getBase()->IgnoreImpCasts()) {
+ if (const Expr *Base = CME->getBase()) {
// The most derived class is marked final.
if (Base->getBestDynamicClassType()->hasAttr<FinalAttr>())
CallIsNonVirtual = true;
diff --git a/clang/test/Analysis/virtualcall.cpp b/clang/test/Analysis/virtualcall.cpp
index 135fa585ece..c22a8463c04 100644
--- a/clang/test/Analysis/virtualcall.cpp
+++ b/clang/test/Analysis/virtualcall.cpp
@@ -271,3 +271,24 @@ int main() {
#if !PUREONLY
//expected-note-re@-2 2{{{{^}}Calling '~E'}}
#endif
+
+namespace PR34451 {
+struct a {
+ void b() {
+ a c[1];
+ c->b();
+ }
+};
+
+class e {
+ public:
+ void b() const;
+};
+
+class c {
+ void m_fn2() const;
+ e d[];
+};
+
+void c::m_fn2() const { d->b(); }
+}
OpenPOWER on IntegriCloud