public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/95832] New: std::vector<bool> specialization leading std::variant ctor treating it as int rather than bool
@ 2020-06-23  4:48 fiesh at zefix dot tv
  2020-06-23  5:04 ` [Bug libstdc++/95832] " fiesh at zefix dot tv
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: fiesh at zefix dot tv @ 2020-06-23  4:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95832

            Bug ID: 95832
           Summary: std::vector<bool> 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 <vector>
#include <variant>

using T = std::variant<int, bool>;

int main()
{
    std::vector<bool> b{false};
    std::vector<T> ts;
    ts.emplace_back(b.back());
    return ts.back().index();
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-23 15:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23  4:48 [Bug libstdc++/95832] New: std::vector<bool> specialization leading std::variant ctor treating it as int rather than bool fiesh at zefix dot tv
2020-06-23  5:04 ` [Bug libstdc++/95832] " fiesh at zefix dot tv
2020-06-23  6:48 ` redi at gcc dot gnu.org
2020-06-23  7:22 ` fiesh at zefix dot tv
2020-06-23  7:39 ` redi at gcc dot gnu.org
2020-06-23  9:27 ` cvs-commit at gcc dot gnu.org
2020-06-23  9:29 ` redi at gcc dot gnu.org
2020-06-23 14:44 ` fiesh at zefix dot tv
2020-06-23 15:36 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).