Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. //test.cpp
  2. #include <type_traits>
  3.  
  4. double* func() {}
  5.  
  6. static_assert(std::is_same<double*(*)(), decltype(func)>::value, "");
  7.  
  8. int main() {}
  9.  
  10. g++ -std=c++11 -c test.cpp
  11.  
  12. test4.cpp:6:1: error: static assertion failed:
  13. static_assert(std::is_same<double*(*)(), decltype(func)>::value, "");
  14. ^
  15.  
  16. double* func() {}
  17. auto ptr = func;
  18.  
  19. static_assert(std::is_same<double*(), decltype(func)>::value, "");
  20. static_assert(std::is_same<double*(*)(), decltype(ptr)>::value, "");
  21.  
  22. int main() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement