diff --git a/Doc/Manual/Cpp0x.html b/Doc/Manual/Cpp0x.html index f983de165..f34d188ca 100644 --- a/Doc/Manual/Cpp0x.html +++ b/Doc/Manual/Cpp0x.html @@ -282,8 +282,7 @@ class DerivedClass: public BaseClass {

7.2.11 Null pointer constant

-

SWIG correctly maps the std::nullptr constant to the null pointer -constant in the target language.

+

The nullptr constant is largely unimportant in wrappers. In the few places it has an effect, it is treated like NULL.

7.2.12 Strongly typed enumerations

diff --git a/Examples/test-suite/cpp0x_null_pointer_constant.i b/Examples/test-suite/cpp0x_null_pointer_constant.i index 7069f3f25..dcb5e61bd 100644 --- a/Examples/test-suite/cpp0x_null_pointer_constant.i +++ b/Examples/test-suite/cpp0x_null_pointer_constant.i @@ -4,13 +4,19 @@ %module cpp0x_null_pointer_constant +%feature("autodoc") A::NullPtrMethod; // Triggers conversion of nullptr to None, nil etc in target language +%feature("compactdefaultargs") A::NullPtrMethod; + %inline %{ -#include + +const int *const MyIntegerPtr = nullptr; class A { public: - A() : _myA(std::nullptr) { } + A() : _myA(nullptr) { } A *_myA; + + void NullPtrMethod(double *ptr = nullptr) {} }; %} diff --git a/Source/Modules/octave.cxx b/Source/Modules/octave.cxx index ad425e3c8..d4e0ad57c 100644 --- a/Source/Modules/octave.cxx +++ b/Source/Modules/octave.cxx @@ -390,7 +390,7 @@ public: Append(decl_str, tex_name); if (value) { - if (Strcmp(value, "NULL") == 0) + if (Strcmp(value, "NULL") == 0 || Strcmp(value, "nullptr") == 0) value = NewString("nil"); else if (Strcmp(value, "true") == 0 || Strcmp(value, "TRUE") == 0) value = NewString("true"); diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index e53009aaa..2a1eda53c 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -1345,6 +1345,7 @@ public: } } if (Strcmp(value, "NULL") == 0 || + Strcmp(value, "nullptr") == 0 || Strcmp(value, "0") == 0 || Strcmp(value, "0L") == 0) { Clear(value); diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index fed5205e1..bc5138c25 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -1444,7 +1444,7 @@ public: return NewString("True"); if (Strcmp(v, "false")==0 || Strcmp(v, "FALSE")==0) return NewString("False"); - if (Strcmp(v, "NULL")==0) + if (Strcmp(v, "NULL")==0 || Strcmp(v, "nullptr")==0) return NewString("None"); } return 0; diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index bcdfd69d3..a0580b97d 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -384,7 +384,7 @@ private: } if (value) { - if (Strcmp(value, "NULL") == 0) + if (Strcmp(value, "NULL") == 0 || Strcmp(value, "nullptr") == 0) value = NewString("nil"); else if (Strcmp(value, "true") == 0 || Strcmp(value, "TRUE") == 0) value = NewString("true");