Skip to content

C++20 breaks broken print_log_value<wchar_t const*>::operator() even more #249

@CaseyCarter

Description

@CaseyCarter

print_log_value<wchar_t const*>::operator():

void
print_log_value<wchar_t const*>::operator()( std::ostream& ostr, wchar_t const* t )
{
ostr << ( t ? t : L"null string" );
}

is completely bogus. Narrow streams (std::ostream& ostr) have no special support for pointer-to-wchar_t, so in C++17 and earlier the result is to call the void* stream insertion operator and output the pointer value rather than the characters it points to.

C++20 helpfully renders this function ill-formed by adding a deleted stream insertion operator for std::ostream and wchar_t const*; see http://eel.is/c++draft/diff.cpp17.input.output#3.

I'm not sure why this function exists, but I suspect it is not fit for purpose.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions