fork download
  1. #include <iostream>
  2. #include <type_traits>
  3. #include <map>
  4.  
  5. template<int C>
  6. struct Test
  7. {
  8. auto blah() const
  9. -> typename std::enable_if
  10. <
  11. C == 1,
  12. bool
  13. >::type
  14. {
  15. return false;
  16. }
  17. };
  18.  
  19. int main()
  20. {
  21. std::map<int, Test<0>> meh;
  22. }
  23.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘struct Test<0>’:
/usr/include/c++/4.8/bits/stl_pair.h:102:11:   required from ‘struct std::pair<const int, Test<0> >’
/usr/include/c++/4.8/bits/stl_tree.h:134:12:   required from ‘struct std::_Rb_tree_node<std::pair<const int, Test<0> > >’
/usr/include/c++/4.8/bits/stl_tree.h:1125:25:   required from ‘void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_erase(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type) [with _Key = int; _Val = std::pair<const int, Test<0> >; _KeyOfValue = std::_Select1st<std::pair<const int, Test<0> > >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, Test<0> > >; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const int, Test<0> > >*]’
/usr/include/c++/4.8/bits/stl_tree.h:671:28:   required from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::~_Rb_tree() [with _Key = int; _Val = std::pair<const int, Test<0> >; _KeyOfValue = std::_Select1st<std::pair<const int, Test<0> > >; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, Test<0> > >]’
/usr/include/c++/4.8/bits/stl_map.h:96:11:   required from here
prog.cpp:8:7: error: no type named ‘type’ in ‘struct std::enable_if<false, bool>’
  auto blah() const
       ^
stdout
Standard output is empty