fork(1) download
  1. #include <iostream>
  2. #include <type_traits>
  3. using namespace std;
  4.  
  5. template<typename T>
  6. void foo2(T&& val)
  7. {
  8. static_assert(std::is_same<int* const, T>::value, "not the same");
  9. }
  10.  
  11. template<typename T>
  12. void foo(T& val)
  13. {
  14. foo2(const_cast<T const>(val));
  15. }
  16.  
  17. int main() {
  18. int* bar;
  19. foo(bar);
  20. return 0;
  21. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty