From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5CD033857C4E; Thu, 23 Jul 2020 19:01:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CD033857C4E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1595530865; bh=0vYzcWMCbnW3/CFT7aUxife3n6zpNnONy65GA3FpPhc=; h=From:To:Subject:Date:From; b=V78M+Dq3+CkuWDyWiRJ9taC0QEBz92tfM99hza4P44jA7/x5n28JbfPyvlYim5HM2 EU9oKaUi/I1VA4wwpEMCQR3F3FwqCLAKw/0iQOgkPc/V0LhJrbjJtdEjNhqQmTdOGl nZvzgMAUmoVTfqzcSR8bgPbvE/rC24mMmCUEA9Mg= From: "matt.lawson at precisionplanting dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/96303] New: Ambiguous overload for operator!= for std::__debug::bitset compiled with -std=c++20 and -pedantic. Date: Thu, 23 Jul 2020 19:01:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 10.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matt.lawson at precisionplanting dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2020 19:01:05 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96303 Bug ID: 96303 Summary: Ambiguous overload for operator!=3D for std::__debug::bitset compiled with -std=3Dc++20 and -pedantic. Product: gcc Version: 10.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: matt.lawson at precisionplanting dot com Target Milestone: --- Hello, In gcc/g++ 10.1.1, the following code produces an ambiguous overload for std::__debug::bitset's operator!=3D when compiled with -D _GLIBCXX_DEBUG -std=3Dc++20 -pedantic (see bottom for full -v -save-temps output): #include int main() { std::bitset<5> x, y; return x !=3D y; } When compiling without _GLIBCXX_DEBUG defined, the non-debug bitset does not produce the same error. Likewise, it does not produce error when compiling with gcc/g++ 9, a previous C++ standard, or without -pedantic.=20=20 It seems the non-debug bitset was updated for P1614R2 (commit 596676d66cab21e5ed85669e737af5b62f067d57), but the debug bitset was not, so= the fix may be as simple as applying the same changes to the debug bitset. Thanks Full -f -save-temps output: g++ -v -save-temps ~/Desktop/debug_bitset.cpp -o ~/Desktop/debug_bitset.o = -D _GLIBCXX_DEBUG -std=3Dc++20 -Wall -Wextra -pedantic -fpermissive -fno-strict-aliasing -fwrapv=20 Using built-in specs. COLLECT_GCC=3D/usr/bin/g++ COLLECT_LTO_WRAPPER=3D/usr/lib64/gcc/x86_64-suse-linux/10/lto-wrapper OFFLOAD_TARGET_NAMES=3Dhsa:nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=3D1 Target: x86_64-suse-linux Configured with: ../configure --prefix=3D/usr --infodir=3D/usr/share/info --mandir=3D/usr/share/man --libdir=3D/usr/lib64 --libexecdir=3D/usr/lib64 --enable-languages=3Dc,c++,objc,fortran,obj-c++,ada,go,d --enable-offload-targets=3Dhsa,nvptx-none=3D/usr/nvptx-none,amdgcn-amdhsa= =3D/usr/amdgcn-amdhsa, --without-cuda-driver --enable-checking=3Drelease --disable-werror --with-gxx-include-dir=3D/usr/include/c++/10 --enable-ssp --disable-libssp --disable-libvtv --disable-cet --disable-libcc1 --enable-plugin --with-bugurl=3Dhttps://bugs.opensuse.org/ --with-pkgversion=3D'SUSE Linux' --with-slibdir=3D/lib64 --with-system-zlib --enable-libstdcxx-allocator=3Dn= ew --disable-libstdcxx-pch --enable-libphobos --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=3D-10 --without-system-libunwind --enable-multilib --with-arch-32=3Dx86-64 --with-tune=3Dgeneric --with-build-config=3Dbootstrap-lto-lean --enable-link-mutex --build=3Dx86_64-suse-linux --host=3Dx86_64-suse-linux Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.1.1 20200625 [revision c91e43e9363bd119a695d64505f96539fa451= bf2] (SUSE Linux)=20 COLLECT_GCC_OPTIONS=3D'-v' '-save-temps' '-o' '/home/mlawson/Desktop/debug_bitset.o' '-D' '_GLIBCXX_DEBUG' '-std=3Dc++2a' '-Wall' '-Wextra' '-Wpedantic' '-fpermissive' '-fno-strict-aliasing' '-fwra= pv' '-shared-libgcc' '-mtune=3Dgeneric' '-march=3Dx86-64' /usr/lib64/gcc/x86_64-suse-linux/10/cc1plus -E -quiet -v -D_GNU_SOURCE -D _GLIBCXX_DEBUG /home/mlawson/Desktop/debug_bitset.cpp -mtune=3Dgeneric -march=3Dx86-64 -std=3Dc++2a -Wall -Wextra -Wpedantic -fpermissive -fno-strict-aliasing -fwrapv -fpch-preprocess -o debug_bitset.ii #include "..." search starts here: #include <...> search starts here: /usr/include/c++/10 /usr/include/c++/10/x86_64-suse-linux /usr/include/c++/10/backward /usr/lib64/gcc/x86_64-suse-linux/10/include /usr/local/include /usr/lib64/gcc/x86_64-suse-linux/10/include-fixed /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/include /usr/include End of search list. COLLECT_GCC_OPTIONS=3D'-v' '-save-temps' '-o' '/home/mlawson/Desktop/debug_bitset.o' '-D' '_GLIBCXX_DEBUG' '-std=3Dc++2a' '-Wall' '-Wextra' '-Wpedantic' '-fpermissive' '-fno-strict-aliasing' '-fwra= pv' '-shared-libgcc' '-mtune=3Dgeneric' '-march=3Dx86-64' /usr/lib64/gcc/x86_64-suse-linux/10/cc1plus -fpreprocessed debug_bitset.ii -quiet -dumpbase debug_bitset.cpp -mtune=3Dgeneric -march=3Dx86-64 -auxbase debug_bitset -Wall -Wextra -Wpedantic -std=3Dc++2a -version -fpermissive -fno-strict-aliasing -fwrapv -o debug_bitset.s GNU C++17 (SUSE Linux) version 10.1.1 20200625 [revision c91e43e9363bd119a695d64505f96539fa451bf2] (x86_64-suse-linux) compiled by GNU C version 10.1.1 20200625 [revision c91e43e9363bd119a695d64505f96539fa451bf2], GMP version 6.2.0, MPFR version 4.0.2-p6, MPC version 1.1.0, isl version isl-0.22.1-GMP GGC heuristics: --param ggc-min-expand=3D100 --param ggc-min-heapsize=3D131= 072 GNU C++17 (SUSE Linux) version 10.1.1 20200625 [revision c91e43e9363bd119a695d64505f96539fa451bf2] (x86_64-suse-linux) compiled by GNU C version 10.1.1 20200625 [revision c91e43e9363bd119a695d64505f96539fa451bf2], GMP version 6.2.0, MPFR version 4.0.2-p6, MPC version 1.1.0, isl version isl-0.22.1-GMP GGC heuristics: --param ggc-min-expand=3D100 --param ggc-min-heapsize=3D131= 072 Compiler executable checksum: 00000000000000000000000000000000 In file included from /usr/include/c++/10/bitset:1595, from /home/mlawson/Desktop/debug_bitset.cpp:1: /usr/include/c++/10/debug/bitset: In instantiation of =E2=80=98bool std::__debug::bitset<_Nb>::operator!=3D(const std::__debug::bitset<_Nb>&) c= onst [with long unsigned int _Nb =3D 5]=E2=80=99: /home/mlawson/Desktop/debug_bitset.cpp:6:15: required from here /usr/include/c++/10/debug/bitset:360:26: error: ambiguous overload for =E2=80=98operator!=3D=E2=80=99 (operand types are =E2=80=98const _Base=E2= =80=99 {aka =E2=80=98const std::__cxx1998::bitset<5>=E2=80=99} and =E2=80=98const std::__debug::bitset= <5>=E2=80=99) 360 | { return _M_base() !=3D __rhs; } | ~~~~~~~~~~^~~~~~~~ /usr/include/c++/10/debug/bitset:355:7: note: candidate: =E2=80=98bool std::__debug::bitset<_Nb>::operator=3D=3D(const std::__debug::bitset<_Nb>&)= const [with long unsigned int _Nb =3D 5]=E2=80=99 (reversed) 355 | operator=3D=3D(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXC= EPT | ^~~~~~~~ In file included from /home/mlawson/Desktop/debug_bitset.cpp:1: /usr/include/c++/10/bitset:1306:7: note: candidate: =E2=80=98bool std::__cxx1998::bitset<_Nb>::operator=3D=3D(const std::__cxx1998::bitset<_N= b>&) const [with long unsigned int _Nb =3D 5]=E2=80=99 (rewritten) 1306 | operator=3D=3D(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXC= EPT | ^~~~~~~~=