mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Windows logic for determining address-only type layout for a C++ type is now unified with other platforms. However, this means that on Windows, a C++ type with a custom destructor, but a default copy constructor is now loadable, even though it's non-trivial. Since Swift does not support such type operations at the moment (it can't be yet destroyed), mark such type as unavailable in Swift instead, when building for the Windows target. This fixes the Windows miscompilation related to such types when they were passed indirectly to C++ functions even though they're actually passed directly.
26 lines
554 B
C++
26 lines
554 B
C++
#ifndef TEST_INTEROP_CXX_CLASS_NODISCARD_H
|
|
#define TEST_INTEROP_CXX_CLASS_NODISCARD_H
|
|
|
|
[[nodiscard]] int NoDiscardAdd(int x, int y);
|
|
|
|
class NoDiscardMultiply {
|
|
public:
|
|
NoDiscardMultiply() {}
|
|
NoDiscardMultiply(const NoDiscardMultiply &) { }
|
|
~NoDiscardMultiply() {}
|
|
|
|
[[nodiscard]] int Multiply(int x, int y) { return x * y; }
|
|
|
|
int Divide(int x, int y) { return x / y; }
|
|
};
|
|
|
|
struct [[nodiscard]] NoDiscardError {
|
|
public:
|
|
NoDiscardError(int value) : value_(value) {}
|
|
int value_;
|
|
};
|
|
|
|
NoDiscardError NoDiscardReturnError(int x, int y);
|
|
|
|
#endif
|