Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Conversation

@bretmckee
Copy link

This allows CHECK_NE(foo, nullptr) to compile and produces "nullptr" for the
string representation of nullptr.

bretmckee added 2 commits May 23, 2019 20:09
This allows CHECK_NE(foo, nullptr) to compile and produces "nullptr" for the
string representation of nullptr.
This is required because nullptr was added for c++11.
void MakeCheckOpValueString(std::ostream* os, const unsigned char& v);

// This is required because nullptr is only present in c++ 11 and later.
#if __cplusplus >= 201103L
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this check is unreliable (e.g., under MSVC). Instead, you should test for std::nullptr_t using CMake and CheckCXXSymbolExists and provide a define (e.g., HAVE_NULLPTR_T) that is eventually used here. The __cplusplus check can be left as a backup.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@sergiud sergiud Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be used as fallback. The actual check should be performed by the build system as previously explained.

@DImuthuUpe
Copy link

Any plan on merging this? I'm seeing compile errors like below when using glog in AppleClang 11.0.3.11030032 for glog 0.4

/usr/local/include/glog/logging.h:640:9: error: use of overloaded operator '<<' is ambiguous (with operand types 'std::ostream' (aka 'basic_ostream') and 'const nullptr_t')
(*os) << v;

@Mizux
Copy link
Contributor

Mizux commented Oct 19, 2020

seems to be the same error in #562

@sergiud
Copy link
Contributor

sergiud commented Apr 8, 2021

The finished changes are now in #641. @bretmckee I hope you are fine with this.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants