Index: unittests/Analysis/ExprMutationAnalyzerTest.cpp =================================================================== --- unittests/Analysis/ExprMutationAnalyzerTest.cpp +++ unittests/Analysis/ExprMutationAnalyzerTest.cpp @@ -1109,4 +1109,48 @@ EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x->mf()")); } +TEST(ExprMutationAnalyzerTest, ReproduceFailure11) { + const std::string Reproducer = + "namespace std {" + "template a&& forward(a & A) { return static_cast(A); }" + "template struct __bind {" + "_Fp d;" + "template __bind(_Fp f, e &&) : d(forward(f)) {}" + "};" + "template void bind(_Fp f, h && g) {" + "__bind<_Fp>(f, g);" + "}" + "template void async(i f, j && g) {" + "bind(f, g);" + "}" + "}" + "void k() {" + "int x = 42;" + "std::async([] {}, x);" + "}"; + auto AST11 = buildASTFromCodeWithArgs(Reproducer, {"-std=c++11"}); + auto Results11 = + match(withEnclosingCompound(declRefTo("x")), AST11->getASTContext()); + EXPECT_FALSE(isMutated(Results11, AST11.get())); +} + +TEST(ExprMutationAnalyzerTest, ReproduceFailureMinimal) { + const std::string Reproducer = + "namespace std {" + "template T forward(T & A) { return static_cast(A); }" + "template struct __bind {" + " T f;" + " template __bind(T v, V &&) : f(forward(v)) {}" + "};" + "}" + "void f() {" + " int x = 42;" + " auto Lambda = [] {};" + " std::__bind(Lambda, x);" + "}"; + auto AST11 = buildASTFromCodeWithArgs(Reproducer, {"-std=c++11"}); + auto Results11 = + match(withEnclosingCompound(declRefTo("x")), AST11->getASTContext()); + EXPECT_FALSE(isMutated(Results11, AST11.get())); +} } // namespace clang