mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The test was passing by accident: we didn't properly check `std::pair` type for completeness, and assumed that it is incomplete. This updates the test to actually verify the behavior that is specified in the vision document.
42 lines
916 B
C++
42 lines
916 B
C++
#pragma once
|
|
|
|
#include <utility>
|
|
#include <string>
|
|
|
|
using PairInts = std::pair<int, int>;
|
|
using PairStrings = std::pair<std::string, std::string>;
|
|
|
|
inline const PairInts &getIntPairPointer() {
|
|
static PairInts value = { 4, 9 };
|
|
return value;
|
|
}
|
|
|
|
inline PairInts getIntPair() {
|
|
return { -5, 12 };
|
|
}
|
|
|
|
struct StructInPair {
|
|
int x;
|
|
int y;
|
|
};
|
|
|
|
using PairStructInt = std::pair<StructInPair, int>;
|
|
|
|
inline PairStructInt getPairStructInt(int x) {
|
|
return { { x * 2, -x}, x };
|
|
}
|
|
|
|
struct UnsafeStruct {
|
|
int *ptr;
|
|
};
|
|
|
|
struct __attribute__((swift_attr("import_iterator"))) Iterator {};
|
|
|
|
using PairUnsafeStructInt = std::pair<UnsafeStruct, int>;
|
|
using PairIteratorInt = std::pair<Iterator, int>;
|
|
|
|
struct __attribute__((swift_attr("import_owned"))) HasMethodThatReturnsUnsafePair {
|
|
PairUnsafeStructInt getUnsafePair() const { return {}; }
|
|
PairIteratorInt getIteratorPair() const { return {}; }
|
|
};
|