Files
swift-mirror/test/Interop/Cxx/reference/Inputs/reference.cpp
Alex Lorenz 62fd801828 [interop] C++ parameter of reference type should be imported as its pointee type in Swift even if parameter's type is type alias
This finally allows std::vector.push_back to be called with the pushed value directly passed into it
2023-05-03 18:23:03 -07:00

31 lines
966 B
C++

#include "reference.h"
static int staticInt = 42;
int getStaticInt() { return staticInt; }
int &getStaticIntRef() { return staticInt; }
int &&getStaticIntRvalueRef() { return static_cast<int &&>(staticInt); }
const int &getConstStaticIntRef() { return staticInt; }
const int &&getConstStaticIntRvalueRef() { return static_cast<int &&>(staticInt); }
void setStaticInt(int i) { staticInt = i; }
void setStaticIntRef(int &i) { staticInt = i; }
void setStaticIntRvalueRef(int &&i) { staticInt = i; }
void setConstStaticIntRef(const int &i) { staticInt = i; }
void setConstStaticIntRvalueRef(const int &&i) { staticInt = i; }
auto getFuncRef() -> int (&)() { return getStaticInt; }
auto getFuncRvalueRef() -> int (&&)() { return getStaticInt; }
void takeConstRef(const int &value) {
staticInt = value;
}
void setConstStaticIntRefTypealias(ConstIntRefTypealias ref) {
staticInt = ref;
}
void setStaticIntRefTypealias(IntRefTypealias ref) {
staticInt = ref;
}