@@ -1779,7 +1779,7 @@ TEST(ExprMutationAnalyzerTest, PointeeMutatedByPassAsArgumentInConstruct) {
17791779TEST (ExprMutationAnalyzerTest,
17801780 PointeeMutatedByPassAsArgumentInTemplateConstruct) {
17811781 const std::string Code = " template<class T> void f() { int *x; new T(x); }" ;
1782- auto AST = buildASTFromCodeWithArgs (Code, {});
1782+ auto AST = buildASTFromCodeWithArgs (Code, {" -fno-delayed-template-parsing " });
17831783 auto Results =
17841784 match (withEnclosingCompound (declRefTo (" x" )), AST->getASTContext ());
17851785 EXPECT_TRUE (isPointeeMutated (Results, AST.get ()));
@@ -1793,7 +1793,8 @@ TEST(ExprMutationAnalyzerTest, PointeeMutatedByPassAsArgumentInInitList) {
17931793 " struct initializer_list{ T const* begin; T const* end; };"
17941794 " }"
17951795 " void f() { int *x; std::initializer_list<int*> a{x, x, x}; }" ;
1796- auto AST = buildASTFromCodeWithArgs (Code, {});
1796+ auto AST =
1797+ buildASTFromCodeWithArgs (Code, {" -fno-delayed-template-parsing" });
17971798 auto Results =
17981799 match (withEnclosingCompound (declRefTo (" x" )), AST->getASTContext ());
17991800 EXPECT_TRUE (isPointeeMutated (Results, AST.get ()));
@@ -1942,4 +1943,16 @@ TEST(ExprMutationAnalyzerTest, PointeeMutatedByPointerArithmeticSubElement) {
19421943 EXPECT_TRUE (isPointeeMutated (Results, AST.get ()));
19431944}
19441945
1946+ TEST (ExprMutationAnalyzerTest, PointeeMutatedByConditionOperator) {
1947+ const std::string Code = R"(
1948+ void f() {
1949+ int* x;
1950+ int* y = 1 ? nullptr : x;
1951+ })" ;
1952+ auto AST = buildASTFromCodeWithArgs (Code, {" -Wno-everything" });
1953+ auto Results =
1954+ match (withEnclosingCompound (declRefTo (" x" )), AST->getASTContext ());
1955+ EXPECT_TRUE (isPointeeMutated (Results, AST.get ()));
1956+ }
1957+
19451958} // namespace clang
0 commit comments