blob: ec2772d0c21d4be349cd8f27149307b2cc6a28ab (
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
33
34
35
36
37
38
39
40
41
42
43
|
/* This testcase checks whether SWIG correctly uses the new 'decltype()'
introduced in C++11.
*/
%module cpp11_decltype
%inline %{
class A {
public:
int i;
decltype(i) j;
auto get_number(decltype(i) a) -> decltype(i) {
if (a==5)
return 10;
else
return 0;
}
};
%}
// These are ignored as unable to deduce decltype for (i+j)
%ignore B::k;
%ignore B::get_number_sum;
%ignore B::get_number_address;
#pragma SWIG nowarn=SWIGWARN_CPP11_DECLTYPE
%inline %{
class B {
public:
int i;
decltype(i) j;
decltype(i+j) k;
auto get_number_sum(decltype(i+j) a) -> decltype(i+j) {
return i+j;
}
auto get_number_address(decltype(&i) a) -> decltype(&i) {
return &i;
}
};
%}
|