------- Comment #4 from pluto at agmk dot net  2010-06-27 09:45 -------
current 4.5 rejects all conversions:

$ cat t.cpp
const                        // this is a const object...
class {
public:
  template<class T>          // convertible to any type
    operator T*() const      // of null non-member
    { return 0; }            // pointer...
  template<class C, class T> // or any type of null
    operator T C::*() const  // member pointer...
    { return 0; }
private:
  void operator&() const;    // whose address can't be taken
} nullptr = {};              // and whose name is nullptr

extern void* p;
struct A
{
  void foo();
};
extern void (A::*pmf)();
int main()
{
  return ( ( p != nullptr ) && ( pmf != nullptr ) );
}


$ g++ t.cpp -std=c++0x -c
t.cpp: In function 'int main()':
t.cpp:22:19: error: no match for 'operator!=' in 'p != nullptr'
t.cpp:22:41: error: no match for 'operator!=' in 'pmf != nullptr'


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33990

Reply via email to