language: C++11 (gcc-4.7.2)
date: 712 days 21 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <vector>
#include <algorithm>
#include <cassert>
 
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; }
 
  void operator&() const = delete;    // whose address can't be taken
} nullptr = {};       
 
int main()
{
   int* ptr = NULL;
   assert( nullptr == ptr );
}
prog.cpp: In function 'int main()':
prog.cpp:21:4: error: no match for 'operator==' in 'nullptr == ptr'