fork(1) download
  1. #include <type_traits>
  2.  
  3. int& get_i(){ static int i = 5; return i; }
  4.  
  5. int main(){
  6. auto i1 = get_i(); // copy
  7. decltype(get_i()) i2 = get_i(); // reference
  8. static_assert(std::is_same<decltype(i1), int>::value, "wut");
  9. static_assert(std::is_same<decltype(i2), int&>::value, "huh");
  10. }
  11.  
Success #stdin #stdout 0s 2880KB
stdin
Standard input is empty
stdout
Standard output is empty