fork(1) download
  1. #include <iostream>
  2. #include <tuple>
  3. #include <typeinfo>
  4.  
  5. template<typename T>
  6. void f()
  7. {
  8. std::cout << typeid(T).name() << std::endl;
  9. }
  10.  
  11. int main()
  12. {
  13. f<std::tuple<void>>();
  14. }
  15.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from prog.cpp:2:0:
/usr/include/c++/5/tuple: In instantiation of 'struct std::_Head_base<0u, void, false>':
/usr/include/c++/5/tuple:339:12:   required from 'struct std::_Tuple_impl<0u, void>'
/usr/include/c++/5/tuple:463:11:   required from 'class std::tuple<void>'
prog.cpp:8:29:   required from 'void f() [with T = std::tuple<void>]'
prog.cpp:13:22:   required from here
/usr/include/c++/5/tuple:107:17: error: forming reference to void
       constexpr _Head_base(const _Head& __h)
                 ^
/usr/include/c++/5/tuple:142:7: error: forming reference to void
       _M_head(_Head_base& __b) noexcept { return __b._M_head_impl; }
       ^
/usr/include/c++/5/tuple:145:7: error: forming reference to void
       _M_head(const _Head_base& __b) noexcept { return __b._M_head_impl; }
       ^
/usr/include/c++/5/tuple:147:13: error: 'std::_Head_base<_Idx, _Head, false>::_M_head_impl' has incomplete type
       _Head _M_head_impl;
             ^
/usr/include/c++/5/tuple:147:13: error: invalid use of 'void'
/usr/include/c++/5/tuple: In instantiation of 'struct std::_Tuple_impl<0u, void>':
/usr/include/c++/5/tuple:463:11:   required from 'class std::tuple<void>'
prog.cpp:8:29:   required from 'void f() [with T = std::tuple<void>]'
prog.cpp:13:22:   required from here
/usr/include/c++/5/tuple:347:7: error: forming reference to void
       _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
       ^
/usr/include/c++/5/tuple:350:7: error: forming reference to void
       _M_head(const _Tuple_impl& __t) noexcept { return _Base::_M_head(__t); }
       ^
/usr/include/c++/5/tuple:356:17: error: forming reference to void
       constexpr _Tuple_impl(const _Head& __head)
                 ^
/usr/include/c++/5/tuple:385:2: error: forming reference to void
  _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a,
  ^
/usr/include/c++/5/tuple: In instantiation of 'class std::tuple<void>':
prog.cpp:8:29:   required from 'void f() [with T = std::tuple<void>]'
prog.cpp:13:22:   required from here
/usr/include/c++/5/tuple:472:17: error: forming reference to void
       constexpr tuple(const _Elements&... __elements)
                 ^
/usr/include/c++/5/tuple:506:2: error: forming reference to void
  tuple(allocator_arg_t __tag, const _Alloc& __a,
  ^
stdout
Standard output is empty