// $ g++ -g -O0 $(pkg-config --cflags --libs glibmm-2.4) ustring.cpp

#include <cstdlib>
#include <iostream>
#include <locale>
#include <sstream>

#include <glibmm.h>

int main(void)
{
  std::locale::global(std::locale(""));

  char carr[10] = "Užduotys";
  char * const cptr = carr;

  std::wostringstream wsout;
  wsout << carr;

  const std::wstring & wstr = wsout.str();
  const gunichar * const data = reinterpret_cast<const gunichar *>(
                                  wstr.data());

  for (int i = 0; wstr.size() > i; i++)
    std::cout << data[i] << std::endl;

  Glib::ustring::format(carr); // fine
  Glib::ustring::format(cptr); // blows up

  return EXIT_SUCCESS;
}
