From df679071681242ec2619c82693f261f1f1c34b80 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 2 Dec 2013 07:06:29 +0000 Subject: [PATCH] Testcase of private nested class usage causing segfault Needs fixing for C#/Java --- Examples/test-suite/common.mk | 1 + Examples/test-suite/nested_private.i | 32 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Examples/test-suite/nested_private.i diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index e5127fd0c..5c2aea787 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -84,6 +84,7 @@ CPP_TEST_BROKEN += \ extend_variable \ li_std_vector_ptr \ li_boost_shared_ptr_template \ + nested_private \ overload_complicated \ template_default_pointer \ template_expr \ diff --git a/Examples/test-suite/nested_private.i b/Examples/test-suite/nested_private.i new file mode 100644 index 000000000..a573fdd5a --- /dev/null +++ b/Examples/test-suite/nested_private.i @@ -0,0 +1,32 @@ +%module nested_private + +// segfault due to private nested class usage + +%inline %{ +#include +class MotorCar { + + struct DesignOpinion { + std::string reason; + }; + +public: + struct WindScreen { + WindScreen(bool opaque) : opaque(opaque) {} + DesignOpinion Opinion(); + private: + bool opaque; + }; + + std::string WindScreenOpinion() { + return MotorCar::WindScreen(true).Opinion().reason; + } +}; + +MotorCar::DesignOpinion MotorCar::WindScreen::Opinion() { + DesignOpinion opinion; + opinion.reason = !opaque ? "great design" : "you can't see out the windscreen"; + return opinion; +} + +%}