Files
swift-mirror/test/Interop/Cxx/class/Inputs/memberwise-initializer.h
Egor Zhdan 9c22a7a530 [cxx-interop] Memberwise init is not synthesized for C++ type with templated using decl
When Swift fails to import a member of a struct, it checks to see if this member could affect the memory layout of the struct, and if it can, Swift doesn't synthesize the memberwise initializer for this struct. This logic was overly restrictive and treated templated using-decls as potentially affecting the memory layout of the struct.

rdar://113044949
2023-07-28 19:53:59 +01:00

76 lines
1.2 KiB
C++

#ifndef TEST_INTEROP_CXX_CLASS_INPUTS_MEMBERWISE_INITIALIZER_H
#define TEST_INTEROP_CXX_CLASS_INPUTS_MEMBERWISE_INITIALIZER_H
template <typename T>
struct TemplatedType {};
struct StructPrivateOnly {
private:
int varPrivate;
};
struct StructPublicOnly {
int varPublic;
};
struct StructEmptyPrivateSection {
int varPublic;
private:
};
struct StructPublicAndPrivate {
int varPublic;
private:
int varPrivate;
};
struct StructWithUnimportedMemberFunction {
int varPublic;
int StructWithUnimportedMemberFunction::* unimportedMemberFunction();
};
class ClassPrivateOnly {
int varPrivate;
};
class ClassPublicOnly {
public:
int varPublic;
};
class ClassEmptyPublicSection {
int varPrivate;
public:
};
class ClassPrivateAndPublic {
int varPrivate;
public:
int varPublic;
};
struct ClassWithUnimportedMemberFunction {
public:
int varPublic;
int ClassWithUnimportedMemberFunction::* unimportedMemberFunction();
};
struct ClassWithTemplatedFunction {
public:
int varPublic;
template <int I>
void foo();
};
struct ClassWithTemplatedUsingDecl {
public:
int varPublic;
template <typename T>
using MyUsing = TemplatedType<T>;
};
#endif