fork download
  1. #include <utility>
  2.  
  3. namespace util {
  4. template< typename t >
  5. t traits_type_entry( t const & ); // Declared, never defined.
  6.  
  7. template< typename t >
  8. using traits_type = decltype( traits_type_entry( std::declval< t >() ) );
  9. }
  10.  
  11. class outer_scope { // Just for illustration
  12. struct special;
  13. struct special_traits {
  14. typedef int value_type;
  15. constexpr static int limit = 5;
  16. };
  17. friend special_traits traits_type_entry( special const & );
  18.  
  19. struct unspecial {
  20. typedef double baz_type;
  21. int table[ util::traits_type< special >::limit ];
  22. };
  23.  
  24. struct special : special_traits {
  25. void f() {
  26. std::pair< typename util::traits_type< unspecial >::baz_type, value_type >();
  27. }
  28. };
  29. };
  30.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i486-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty