fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Foo {
  5. struct {
  6. operator float() const { return 0.0f; }
  7. } bar;
  8. };
  9.  
  10. void bar(const float *f) {}
  11.  
  12. int main() {
  13. Foo f;
  14. bar(&f.bar);
  15. return 0;
  16. }
Compilation error #stdin compilation error #stdout 0s 15240KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:12: error: cannot convert ‘Foo::<anonymous struct>*’ to ‘const float*’ for argument ‘1’ to ‘void bar(const float*)’
  bar(&f.bar);
            ^
stdout
Standard output is empty