https://bugs.llvm.org/show_bug.cgi?id=49557

            Bug ID: 49557
           Summary: StencilTest.cpp has an un-executed EXPECT_THAT test
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Tooling
          Assignee: unassignedclangb...@nondot.org
          Reporter: paul_robin...@playstation.sony.com
                CC: llvm-bugs@lists.llvm.org

clang/unittests/Tooling/StencilTest.cpp has a test "CatOfInvalidRangeFails"
that ends with this code:

  Expected<std::string> Result = S->eval(StmtMatch->Result);
  ASSERT_THAT_EXPECTED(Result, Failed<StringError>());
  llvm::handleAllErrors(Result.takeError(), [](const llvm::StringError &E) {
    EXPECT_THAT(E.getMessage(), AllOf(HasSubstr("selected range"),
                                      HasSubstr("macro expansion")));
  });

However, the EXPECT_THAT is never executed (replacing it with an assert
or llvm_unreachable does not fire).

ASSERT_THAT_EXPECTED calls TakeExpected, which calls takeError(), and you
can't call takeError() twice on an Expected<T>.


Found by the Rotten Green Tests project.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to