This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/69191] Wrong equality comparison between error_code and error_condition + segfault


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

Kristian Spangsege <kristian.spangsege at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kristian.spangsege at gmail dot co
                   |                            |m

--- Comment #13 from Kristian Spangsege <kristian.spangsege at gmail dot com> ---
I've now run into this problem too, and it seems to be general, not just
limited to Ubuntu.

There is the code that I compile:

    #include <cerrno>
    #include <system_error>
    #include <iostream>

    int main()
    {
        std::error_code ec(EDOM, std::system_category());
        bool b = (ec == std::errc::argument_out_of_domain);
        std::cout << b << "\n";
    }

I expect it to write `1`, not `0`.

I get the expected result with Clang on OS X. I get the wrong result with

 - GCC 6.1.1 on Fedora 24, which links against libstdc++.so.6.0.22
 - GCC 5.4.0 on Linux Mint 18 (Ubuntu 14.04), which links against
libstdc++.so.6.0.21
 - GCC 4.9.3 on Linux Mint 17.1 (Ubuntu 16.04), which links against
libstdc++.so.6.0.22

It therefore seems to me that this is really a bug in libstdc++.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]