Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit e8df214

Browse files
committed
Merge remote-tracking branch 'origin/swift-5.1-branch' into stable
2 parents cd0368b + dc19f46 commit e8df214

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/Sema/SemaDeclCXX.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,10 @@ static DeclAccessPair findDecomposableBaseClass(Sema &S, SourceLocation Loc,
13011301
static bool checkMemberDecomposition(Sema &S, ArrayRef<BindingDecl*> Bindings,
13021302
ValueDecl *Src, QualType DecompType,
13031303
const CXXRecordDecl *OrigRD) {
1304+
if (S.RequireCompleteType(Src->getLocation(), DecompType,
1305+
diag::err_incomplete_type))
1306+
return true;
1307+
13041308
CXXCastPath BasePath;
13051309
DeclAccessPair BasePair =
13061310
findDecomposableBaseClass(S, Src->getLocation(), OrigRD, BasePath);

test/SemaCXX/cxx1z-decomposition.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,21 @@ struct PR37352 {
8181
void f() { static auto [a] = *this; } // expected-error {{cannot be declared 'static'}}
8282
};
8383

84+
namespace instantiate_template {
85+
86+
template <typename T1, typename T2>
87+
struct pair {
88+
T1 a;
89+
T2 b;
90+
};
91+
92+
const pair<int, int> &f1();
93+
94+
int f2() {
95+
const auto &[a, b] = f1();
96+
return a + b;
97+
}
98+
99+
} // namespace instantiate_template
100+
84101
// FIXME: by-value array copies

0 commit comments

Comments
 (0)