Skip to content

gjs/jsapi-util.cpp: fix build on gcc-12

Sergei Trofimovich requested to merge trofi/gjs:fix-gcc-12-build into master

c++17 (gcc-12 default) and disallows std::string to be initialized by NULL pointer:

../gjs/jsapi-util.cpp: In function 'std::string _gjs_g_utf8_make_valid(const char*)':
  ...-glib-2.70.2-dev/include/glib-2.0/glib/gmessages.h:652:20:
    error: use of deleted function 'std::...::basic_string(std::nullptr_t)
      [with _CharT = char; _Traits = std::char_traits<char>;
        _Alloc = std::allocator<char>; std::nullptr_t = std::nullptr_t]'
  652 |         return (val); \
      |                    ^
../gjs/jsapi-util.cpp:273:5: note: in expansion of macro 'g_return_val_if_fail'
  273 |     g_return_val_if_fail (name != NULL, NULL);
      |     ^~~~~~~~~~~~~~~~~~~~

Merge request reports

Loading