Skip to content

std::string can't be returned as NULL #44

Description

@brechtsanders

In StringTokenizer::GetNextToken() in Utilities/StringTokenizer.cpp the line return(NULL); is not correct as the function returns a std::string which can't be set to NULL..

In fact, GCC 12 will give the following error:

Utilities/StringTokenizer.cpp:238:28: error: use of deleted function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::nullptr_t = std::nullptr_t]'

Changing the line return(NULL); to return(""); fixes this.

P.S.: I know GCC 12 isn't released yet, but the current stage 3 prerelease already works quite well.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions