fork download
  1. #include <type_traits>
  2. #include <iostream>
  3.  
  4. template<class T>
  5. struct trait{ using type = typename T::type; };
  6.  
  7. template<class T, class U = typename trait<T>::type>
  8. void f(int);
  9. void f(...);
  10.  
  11. template<class T, class U = typename T::type>
  12. int g(int);
  13. void g(...);
  14.  
  15. template<class>
  16. struct dependent_false : std::true_type{};
  17.  
  18. template<class T>
  19. struct X{
  20. static_assert(dependent_false<T>(), "...");
  21. using type = void;
  22. };
  23.  
  24. int main(){
  25. // f<int>(0);
  26. decltype(g<X<int>>(0)) y=5;
  27. std::cout<<"y: "<<y<<std::endl;
  28. }
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
y: 5