From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 933BA3840C0B; Tue, 23 Jun 2020 04:48:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 933BA3840C0B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592887719; bh=mMX8qEQ+x5EafqPy2bBgn53WbMM8kBm5sTo/RwX2LbQ=; h=From:To:Subject:Date:From; b=tShZuXZ7OPV4vYzK/B3yT3KD9NRW/ksXA2r+/j+LVk2xHt4ntFo9v2jacp+UOQCj7 ZR0gNIo1/bqvJKLOyyHshvXbRAUvGBX4tGi5W87bKwBvZxBrsiYQv5p3+6IRkWc2gj 2q+Z8OzzItO8/M+ivaUQvUgxB/nu6kGN0wPyS35Q= From: "fiesh at zefix dot tv" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/95832] New: std::vector specialization leading std::variant ctor treating it as int rather than bool Date: Tue, 23 Jun 2020 04:48:39 +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: fiesh at zefix dot tv 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, 23 Jun 2020 04:48:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95832 Bug ID: 95832 Summary: std::vector specialization leading std::variant ctor treating it as int rather than bool Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: fiesh at zefix dot tv Target Milestone: --- The following code returned 1 when compiled with gcc-9 but returns 0 with gcc-10. Since clang exhibits the exact same behavior depending on the installed gcc version, I suppose it might be because of libstdc++. It's worth noting that MSVC on godbolt also returns 0. My primitive reading skills suggest to me that http://eel.is/c++draft/variant#ctor-14 says it should be 1. (Overload resolution works correctly in that it prefers an f(bool) over an f(int) when passed b.back().) #include #include using T =3D std::variant; int main() { std::vector b{false}; std::vector ts; ts.emplace_back(b.back()); return ts.back().index(); }=