google / google/googletest

1.11.0: build fails bug with clang_for_win

Open
#3,520 0 comments 0 reactions 1 assignee Claimed by @sbenzaquen View on GitHub
bug
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

**Describe the bug**

compilation breaks with clang-win-x86_64

```
googletest/include/gtest/gtest-printers.h(221,12): error: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Werror,-Wmicrosoft-cast]
*os << value;
^~~~~
googletest/include/gtest/gtest-printers.h(321,12): note: in instantiation of function template specialization 'testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter::PrintValue<(lambda at test.cpp:17:5), void, std::basic_ostream &>' requested here
Printer::PrintValue(value, os);
^
googletest/include/gtest/gtest-printers.h(450,13): note: in instantiation of function template specialization 'testing::internal::PrintWithFallback<(lambda at test.cpp:17:5)>' requested here
internal::PrintWithFallback(value, os);
^
googletest/include/gtest/gtest-printers.h(700,5): note: in instantiation of function template specialization 'testing::internal::PrintTo<(lambda at test.cpp:17:5)>' requested here
PrintTo(value, os);
^
googletest/include/gtest/gtest-printers.h(989,25): note: in instantiation of member function 'testing::internal::UniversalPrinter<(lambda at test.cpp:17:5)>::Print' requested here
UniversalPrinter::Print(value, os);
^
googlemock/include/gmock/gmoc
..[truncated]..
eption_test.cpp:310:5)>' requested here
internal::PrintWithFallback(value, os);
^
googletest/include/gtest/gtest-printers.h(700,5): note: in instantiation of function template specialization 'testing::internal::PrintTo<(lambda at test.cpp:310:5)>' requested here
PrintTo(value, os);
^
googletest/include/gtest/gtest-printers.h(989,25): note: in instantiation of member function 'testing::internal::UniversalPrinter<(lambda at test.cpp:310:5)>::Print' requested here
UniversalPrinter::Print(value, os);
^
googlemock/include/gmock/gmock-matchers.h(595,3): note: in instantiation of function template specialization 'testing::internal::UniversalPrint<(lambda at test.cpp:310:5)>' requested here
UniversalPrint(value, listener->stream());
^
googlemock/include/gmock/gmock-matchers.h(1549,9): note: in instantiation of function template specialization 'testing::internal::MatchPrintAndExplain' requested here
if (MatchPrintAndExplain(x, matcher, &listener)) {
^
test.cpp(310,5): note: in instantiation of function template specialization 'testing::internal::PredicateFormatterFromMatcher>>::operator()<(lambda at test.cpp:310:5)>' requested here
EXPECT_THAT(
```

**Steps to reproduce the bug**

code, that fails to compile:

```
EXPECT_THAT(
[]() { ASSERT(false && "Test assert"); },
testing::ThrowsMessage(testing::HasSubstr("assertion failed: false && \"Test assert\""))
);
```

**Does the bug persist in the most recent commit?**

Yes

**What operating system and version are you using?**

Windows

**What compiler and version are you using?**

clang 12.0.1

**What build system are you using?**

make

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.