fork download
  1. #include <cstdint>
  2.  
  3. typedef uint8_t testtype;
  4.  
  5. enum testenum : uint8_t {
  6. };
  7.  
  8. void foo(uint8_t& v) {}
  9.  
  10. int main() {
  11. testtype bar;
  12. foo(bar);
  13.  
  14. testenum baz;
  15. foo(baz);
  16.  
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 3456KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:15:9: error: invalid initialization of non-const reference of type 'uint8_t& {aka unsigned char&}' from an rvalue of type 'uint8_t {aka unsigned char}'
  foo(baz);
         ^
prog.cpp:8:6: note:   initializing argument 1 of 'void foo(uint8_t&)'
 void foo(uint8_t& v) {}
      ^
stdout
Standard output is empty