fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class C,typename T, T C::*v>
  5. struct getPointerType {
  6. typedef T type;
  7. };
  8.  
  9. class Test {
  10. int value;
  11. };
  12.  
  13. int main() {
  14. int Test::*member=nullptr;
  15. cout << typeid(getPointerType<Test, int, decltype(member)>::type) << std::endl;
  16. return 0;
  17. }
Compilation error #stdin compilation error #stdout 0s 3340KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:15:59: error: type/value mismatch at argument 3 in template parameter list for ‘template<class C, class T, T C::* v> struct getPointerType’
  cout << typeid(getPointerType<Test, int, decltype(member)>::type) << std::endl;
                                                           ^
prog.cpp:15:59: error:   expected a constant of type ‘T C::*’, got ‘int Test::*’
stdout
Standard output is empty