mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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
76 lines
1.2 KiB
C++
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
|