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 doesn’t 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.

Couldn‘t „static_cast<void*>(0)“ simply be replaced with „0“?

 

Best Regards

 

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to