summaryrefslogtreecommitdiff
path: root/Examples/test-suite/nested_private.i
blob: a573fdd5aa19c1f3f11a53388e277dd4bf249082 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
%module nested_private

// segfault due to private nested class usage

%inline %{
#include <string>
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;
}

%}