fork download
  1. template<class...> struct types{ using type = types; };
  2.  
  3. template<class Acc, class... Types>
  4. struct reversed_ : Acc{};
  5.  
  6. template<class... RTypes, class Head, class... Tail>
  7. struct reversed_<types<RTypes...>, Head, Tail...> : reversed_<types<Head, RTypes...>, Tail...>{};
  8.  
  9. template<class... Ts>
  10. struct reversed : reversed_<types<>, Ts...>{};
  11.  
  12. int main()
  13. {
  14. struct {} _ = reversed<char>::type();
  15. struct {} __ = reversed<char, int>::type();
  16. }
  17.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:40: error: conversion from ‘types<char>::type {aka types<char>}’ to non-scalar type ‘main()::<anonymous struct>’ requested
     struct {} _ = reversed<char>::type();
                                        ^
prog.cpp:15:46: error: conversion from ‘types<int, char>::type {aka types<int, char>}’ to non-scalar type ‘main()::<anonymous struct>’ requested
     struct {} __ = reversed<char, int>::type();
                                              ^
stdout
Standard output is empty