fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4.  
  5. template <typename CharT>
  6. void test() {
  7. struct Destructible_ctype : public std::ctype<CharT>
  8. {
  9. Destructible_ctype(std::size_t refs = 0) {}
  10. // note: the implicit destructor is public
  11. } dc;
  12.  
  13. {
  14. std::basic_ostringstream<CharT> oss;
  15. oss << 123;
  16. std::cerr << oss.str().size() << std::endl;
  17. }
  18. {
  19. std::basic_ostringstream<CharT> oss;
  20. oss << 1234.56;
  21. std::cerr << oss.str().size() << std::endl;
  22. }
  23. {
  24. std::basic_ostringstream<CharT> oss;
  25. oss << std::setfill(CharT(' '));
  26. // oss << 123;
  27. std::cerr << oss.str().size() << std::endl;
  28. }
  29. }
  30.  
  31. int main()
  32. {
  33. std::cerr << "char:" << std::endl;
  34. test<char>();
  35. std::cerr << std::endl;
  36. std::cerr << "wchar_t:" << std::endl;
  37. test<wchar_t>();
  38. std::cerr << std::endl;
  39. std::cerr << "char32_t:" << std::endl;
  40. test<char32_t>();
  41. std::cerr << std::endl;
  42. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o: in function `test<char32_t>()::Destructible_ctype::~Destructible_ctype()':
prog.cpp:(.text._ZZ4testIDiEvvEN18Destructible_ctypeD2Ev[_ZZ4testIDiEvvEN18Destructible_ctypeD5Ev]+0xb): undefined reference to `std::ctype<char32_t>::~ctype()'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o: in function `test<char32_t>()::Destructible_ctype::~Destructible_ctype()':
prog.cpp:(.text._ZZ4testIDiEvvEN18Destructible_ctypeD0Ev[_ZZ4testIDiEvvEN18Destructible_ctypeD5Ev]+0xf): undefined reference to `std::ctype<char32_t>::~ctype()'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o: in function `void test<char32_t>()':
prog.cpp:(.text._Z4testIDiEvv[_Z4testIDiEvv]+0x8ea): undefined reference to `std::ctype<char32_t>::~ctype()'
/usr/bin/ld: prog.cpp:(.text._Z4testIDiEvv[_Z4testIDiEvv]+0xb2c): undefined reference to `std::ctype<char32_t>::~ctype()'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x20): undefined reference to `std::ctype<char32_t>::do_is(unsigned short, char32_t) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x28): undefined reference to `std::ctype<char32_t>::do_is(char32_t const*, char32_t const*, unsigned short*) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x30): undefined reference to `std::ctype<char32_t>::do_scan_is(unsigned short, char32_t const*, char32_t const*) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x38): undefined reference to `std::ctype<char32_t>::do_scan_not(unsigned short, char32_t const*, char32_t const*) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x40): undefined reference to `std::ctype<char32_t>::do_toupper(char32_t) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x48): undefined reference to `std::ctype<char32_t>::do_toupper(char32_t*, char32_t const*) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x50): undefined reference to `std::ctype<char32_t>::do_tolower(char32_t) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x58): undefined reference to `std::ctype<char32_t>::do_tolower(char32_t*, char32_t const*) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x60): undefined reference to `std::ctype<char32_t>::do_widen(char) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x68): undefined reference to `std::ctype<char32_t>::do_widen(char const*, char const*, char32_t*) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x70): undefined reference to `std::ctype<char32_t>::do_narrow(char32_t, char) const'
/usr/bin/ld: /home/ZV5zzb/ccuvaQdQ.o:(.data.rel.ro._ZTVZ4testIDiEvvE18Destructible_ctype[_ZTVZ4testIDiEvvE18Destructible_ctype]+0x78): undefined reference to `std::ctype<char32_t>::do_narrow(char32_t const*, char32_t const*, char, char*) const'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty