https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94299
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution|--- |INVALID --- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- GCC is correct: llvm::StringRef GetHelp() { return (m_help.empty() ? "" : m_help); } has a std::string temp for "" because the conversion to std::string in the ?:. And then StringRef::StringRef does: /// Construct a string ref from an std::string. /*implicit*/ StringRef(const std::string &Str) : Data(Str.data()), Length(Str.length()) {} So GCC is correct.