[CMake] Problems with WriteCompilerDetectionHeader and cxx_nullptr
Roman Wüger
roman.wueger at gmx.at
Wed Mar 11 17:22:18 EDT 2015
Hello,
i tried to use the generated compiler detection header but get an error if I
use the cxx_nullptr feature on a compiler which doesnt support C++11.
void doSomething(int n, bool *ok = 0) {
if (ok)
*ok = true;
if (n != 0) {
if (ok)
*ok = false;
}
}
This simple example produces the following error on Mac OS:
error: cannot initialize a parameter of type 'bool *' with an rvalue of type
'void *'
void doSomething(int n = 1, bool *ok = static_cast<void*>(0)) {
^ ~~~~~~~~~~~~~~~~~~~~~
However, if C++11 could be used then the nullptr is working fine.
Couldnt static_cast<void*>(0) simply be replaced with 0?
Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150311/5a4ff541/attachment.html>
More information about the CMake
mailing list