diff options
Diffstat (limited to 'clang/unittests/Analysis')
| -rw-r--r-- | clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp b/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp index ef22960..8fc9a66d 100644 --- a/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp +++ b/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp @@ -2076,4 +2076,19 @@ TEST(ExprMutationAnalyzerTest, PointeeMutatedByReturn) { } } +TEST(ExprMutationAnalyzerTest, PointeeMutatedByPointerToMemberOperator) { + // GH161913 + const std::string Code = R"( + struct S { int i; }; + void f(S s) { + S *x = &s; + (x->*(&S::i))++; + } + )"; + auto AST = buildASTFromCodeWithArgs(Code, {"-Wno-everything"}); + auto Results = + match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); + EXPECT_TRUE(isPointeeMutated(Results, AST.get())); +} + } // namespace clang |
