fork download
  1. #include <stdint.h>
  2. #include <type_traits>
  3.  
  4. uint64_t foo(uint16_t a) {
  5. auto x = (a & 0xFFFF);
  6. static_assert(std::is_same<int32_t, decltype(x)>::value, "not an int32_t")
  7. static_assert(std::is_same<uint16_t, decltype(x)>::value, "not a uint16_t");
  8. return x;
  9. }
  10.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'uint64_t foo(uint16_t)':
prog.cpp:7:4: error: expected ';' before 'static_assert'
    static_assert(std::is_same<uint16_t, decltype(x)>::value, "not a uint16_t");
    ^
prog.cpp:7:4: error: static assertion failed: not a uint16_t
stdout
Standard output is empty