fork download
  1. struct A {
  2. operator long();
  3. };
  4.  
  5. struct B : A {
  6. operator unsigned() &&;
  7. };
  8.  
  9. int main() {
  10. int x = B();
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:10:12: error: conversion from ‘B’ to ‘int’ is ambiguous
  int x = B();
            ^
prog.cpp:10:12: note: candidates are:
prog.cpp:6:2: note: B::operator unsigned int() &&
  operator unsigned() &&;
  ^
prog.cpp:2:2: note: A::operator long int()
  operator long();
  ^
prog.cpp:10:6: warning: unused variable ‘x’ [-Wunused-variable]
  int x = B();
      ^
stdout
Standard output is empty