view gcc/testsuite/g++.dg/conversion/cond4.C @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 04ced10e8804
children
line wrap: on
line source

// Origin: PR c++/45383
// { dg-do run }

struct null {
    null() {}
    template<class T>
    operator T*() const {
    return 0;
    }

    template<class C, class T>
    operator T C::*() const {
    return 0;
    }
private:
    null(const null&);
    null& operator=(const null&);
    void operator&() const;
};

static struct null null;

int
main()
{
    int* ptr = null;
    if (ptr == null)
        return 0;
    if (ptr != null)
        return 1;
}