fork download
  1. #include <iostream>
  2. #include <type_traits>
  3. #include <typeinfo>
  4.  
  5. using namespace std;
  6.  
  7. true_type foo();
  8.  
  9. template <typename T>
  10. struct bar{
  11. using def = conditional_t<decltype(foo())::value, char, void>;
  12. };
  13.  
  14. int main() {
  15. cout << typeid(bar<int>::def).name() << endl;
  16.  
  17. cout << decltype(foo())::value << endl;
  18. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
c
1