fork download
  1.  
  2. #include <iostream>
  3.  
  4. char f = 0;
  5.  
  6. struct Bad {
  7. operator char &() { return f; }
  8. Bad *operator&() { return 0; }
  9. };
  10.  
  11. int main() {
  12. Bad b;
  13. std::cout << (void*)(&f) << "\n";
  14. std::cout << (void*)(&b) << "\n";
  15. std::cout << (void*)(&reinterpret_cast<char &>(b)) << "\n";
  16. std::cout << (void*)(&(char &)b) << "\n";
  17. }
  18.  
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
0x804a0d4
0
0xbfed0347
0x804a0d4