Open jralls opened 3 years ago
Here's a godbolt demonstrating the problem. Note that I've ifdefed out everything except the constructors and the overloaded operator<<
.
Thank you for reporting this issue so extensively, John. I seen now, it appears reproducible, even without using GncInt128, by:
#include <gtest/gtest-printers.h>
#include <iosfwd>
struct Foo {
template <typename T> Foo(T);
};
void operator<<(std::ostream&, const Foo&);
Thanks for reporting! We'll revert https://github.com/google/googletest/commit/ac3c2a8d0496893787015014a5abd397b766cce2.
@dinord Would it still make sense to you to look what goes on here? Is it a compiler bug? Could there be a workaround?
Commit ac3c2a8d0496893787015014a5abd397b766cce2 (pull request #3184) simply just adds two PrintTo
overloads. Wasn't the whole idea of PrintTo
that it could be customized for specific types by adding overloads?
@N-Dekker Sure, but I'd prefer to revert first in order to unblock users building from head.
I tried the Intel and Microsoft compilers on godbolt and they both compiled the code without error; I already noted that clang does too. That surely suggests that there's at least a difference with gcc so it's worth trying to get the gcc devs to look at it.
Pending PR fixing this (for visibility): https://github.com/google/googletest/pull/3993
Describe the bug
Build fails:
Followed by a long list of SFINAE failure messages for every other overload of
operator<<
.Steps to reproduce the bug
Get https://raw.githubusercontent.com/Gnucash/gnucash/maint/libgnucash/engine/gnc-int128.hpp Create the following
gtest-test.cpp
:compile with
Making any adjustments needed to find the two includes.
Commenting out line 279
will allow the compilation to succeed.
Does the bug persist in the most recent commit?
Yes.
What operating system and version are you using?
Arch Linux, fully updated yesterday. The problem was first discovered using Ubuntu 21.04 with their packaged googletest.
The problem does not reproduce on macOS 11.2 with Xcode 12.3's clang.
What compiler and version are you using?
$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-werror gdc_include_dir=/usr/include/dlang/gdc Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.2.0 (GCC) What build system are you using?
N/A
Additional context
I have bisected the problem, it is caused by commit ac3c2a8d0496893787015014a5abd397b766cce2 "overload PrintTo for std::type_info and std::type_index" and reverting it allows compilation to complete normally.