fork download
  1. template<typename Type, typename>
  2. struct type_wrapper {
  3. Type value;
  4. };
  5.  
  6. typedef type_wrapper<int, class Person> PersonId;
  7. typedef type_wrapper<int, class Group> GroupId;
  8.  
  9. void queryPersonName(PersonId id) {}
  10.  
  11. int main() {
  12. GroupId id = { 10 };
  13. queryPersonName(id);
  14. }
Compilation error #stdin compilation error #stdout 0s 3452KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:13:20: error: could not convert 'id' from 'GroupId {aka type_wrapper<int, Group>}' to 'PersonId {aka type_wrapper<int, Person>}'
  queryPersonName(id);
                    ^
stdout
Standard output is empty