OK got the smallest reproducer I could come up with:
cmake_pch.hxx ```cpp /* generated by CMake */
#pragma GCC system_header #ifdef __cplusplus #include <gmock/gmock.h> #include <gtest/gtest.h> #endif // __cplusplus ```
cmake_pch.hxx.cxx ```cpp /* generated by CMake */ ```
tmp.cpp ```cpp class Class { public: void member(bool) {}; };
namespace {
struct MockClass : public Class { MOCK_METHOD1(member, void(bool)); };
}
TEST(Test, tests) { MockClass object; EXPECT_CALL(object, member(testing::_)); } ```
``` /usr/bin/g++-12 -I/usr/src/googletest/googlemock/include -O2 -std=c++20 -include cmake_pch.hxx -include cmake_pch.hxx -x c++-header -o cmake_pch.hxx.gch -c cmake_pch.hxx.cxx /usr/bin/g++-12 -I/usr/src/googletest/googlemock/include -O2 -std=c++20 -include cmake_pch.hxx -c tmp.cpp ```
Replace with `g++-11`, and it's fine.
OK got the smallest reproducer I could come up with:
cmake_pch.hxx
```cpp
/* generated by CMake */
#pragma GCC system_header
#ifdef __cplusplus
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#endif // __cplusplus
```
cmake_pch.hxx.cxx
```cpp
/* generated by CMake */
```
tmp.cpp
```cpp
class Class
{
public:
void member(bool) {};
};
namespace
{
struct MockClass : public Class METHOD1( member, void(bool));
{
MOCK_
};
}
TEST(Test, tests) CALL(object, member( testing: :_));
{
MockClass object;
EXPECT_
}
```
``` src/googletest/ googlemock/ include -O2 -std=c++20 -include cmake_pch.hxx -include cmake_pch.hxx -x c++-header -o cmake_pch.hxx.gch -c cmake_pch.hxx.cxx src/googletest/ googlemock/ include -O2 -std=c++20 -include cmake_pch.hxx -c tmp.cpp
/usr/bin/g++-12 -I/usr/
/usr/bin/g++-12 -I/usr/
```
Replace with `g++-11`, and it's fine.