Bug 68258 - core 879 Missing built-in comparison operators for pointer types not supported
Summary: core 879 Missing built-in comparison operators for pointer types not supported
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.2
: P3 normal
Target Milestone: 11.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2015-11-09 18:05 UTC by derrick
Modified: 2024-01-13 18:32 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 6.0
Last reconfirmed: 2015-11-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description derrick 2015-11-09 18:05:29 UTC
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#879
not implemented, while clang3.6 works.
Code:

#include <cstddef>
struct X_
        {
        operator std::nullptr_t() { return nullptr; }
        };
struct Y_
        {
        operator std::nullptr_t() { return nullptr; }
        };
int main()
{
    X_ x;
    Y_ y;
    bool z = x != y;

    return 0;
}

Compile error:
main.cpp: In function 'int main()':

main.cpp:15:28: error: no match for 'operator!=' (operand types are 'X_' and 'Y_')

                 bool z = x != y;

                            ^
Comment 1 Richard Biener 2015-11-10 09:29:17 UTC
Confirmed.
Comment 2 Andrew Pinski 2021-07-23 02:59:32 UTC
Fixed in GCC 11 by r11-467:
        * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
        operator functions when type is std::nullptr_t for ==/!=.