From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EAE61386191F; Tue, 21 Jul 2020 14:44:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAE61386191F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1595342687; bh=C2mHUYWFUBSeS0sHcHD5tbGdHkTjK/30+L7Oq/ZzuQ8=; h=From:To:Subject:Date:From; b=QhvPQLtownAjzVjhQ1kMrXMcCyX2quRfhvb6RXnPwZ7N39AdQ52Rp6f7o9OcNjRR2 jY3XDktuHtgepO2eBunpIW2GFp3C0KxCKY6AD0UTyBw4R3xjvE5JevG0OjWgL3qTCY 3DtChQNTOvJUK1VnDwUibcAigt6pfuYCR3UU0jzA= From: "sshannin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/96269] New: optional comparison with nullopt fails Date: Tue, 21 Jul 2020 14:44:47 +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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sshannin at gmail 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: Tue, 21 Jul 2020 14:44:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96269 Bug ID: 96269 Summary: optional comparison with nullopt fails Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: sshannin at gmail dot com Target Milestone: --- Consider the following: seth@dev6:~/tmp$ cat opt.cpp #include struct X { template bool operator=3D=3D(const T&) { return false; } }; bool foo() { std::optional x; #ifndef FLIP return x =3D=3D std::nullopt; #else return std::nullopt =3D=3D x; #endif } With gcc 9.1.0, this compiles regardless of whether or not FLIP is defined. With gcc 10.1.0 however, the FLIP variant does not compile. seth@dev6:~/tmp$ /toolchain15/bin/g++ -c -o opt.o opt.cpp --std=3Dc++20 seth@dev6:~/tmp$ /toolchain15/bin/g++ -c -o opt.o opt.cpp --std=3Dc++20 -DF= LIP In file included from opt.cpp:1: /toolchain15/include/c++/10.1.0/optional: In instantiation of =E2=80=98cons= texpr std::__optional_relop_t() =3D=3D declval<_Tp>()))> std::operator=3D=3D(const _Up&, const std::optional<_Tp>&) [with _Tp =3D X;= _Up =3D std::nullopt_t; std::__optional_relop_t() =3D=3D declval<_Tp>()))> =3D bool; decltype ((declval<_Up>() =3D=3D declval<_Tp>()= )) =3D bool]=E2=80=99 ...etc... It's a tad hard for me to keep track of which overloads are supposed to exist/how they're supposed to resolve and I think introduction of <=3D> was expected to change behavior here a bit, so I'm not actually sure if this is supposed to compile still. seth@dev6:~/tmp$ /toolchain15/bin/g++ -v Using built-in specs. COLLECT_GCC=3D/toolchain15/bin/g++ COLLECT_LTO_WRAPPER=3D/toolchain15/bin/../libexec/gcc/x86_64-pc-linux-gnu/1= 0.1.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc_10_1_0/configure --prefix=3D/toolchain15 --enable-languages=3Dc,c++,fortran --enable-lto --disable-plugin --program-suffix=3D-10.1.0 --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.1.0 (GCC)=