[PATCH] D56974: [SemaCXX] Fix ICE with structure bindings to members of template
Nicolas Lesser via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 27 11:21:35 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352323: [SemaCXX] Fix ICE with structure bindings to members of template (authored by Rakete1111, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D56974?vs=182695&id=183761#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56974/new/
https://reviews.llvm.org/D56974
Files:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp
Index: cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp
+++ cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp
@@ -81,4 +81,21 @@
void f() { static auto [a] = *this; } // expected-error {{cannot be declared 'static'}}
};
+namespace instantiate_template {
+
+template <typename T1, typename T2>
+struct pair {
+ T1 a;
+ T2 b;
+};
+
+const pair<int, int> &f1();
+
+int f2() {
+ const auto &[a, b] = f1();
+ return a + b;
+}
+
+} // namespace instantiate_template
+
// FIXME: by-value array copies
Index: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp
@@ -1300,6 +1300,10 @@
static bool checkMemberDecomposition(Sema &S, ArrayRef<BindingDecl*> Bindings,
ValueDecl *Src, QualType DecompType,
const CXXRecordDecl *OrigRD) {
+ if (S.RequireCompleteType(Src->getLocation(), DecompType,
+ diag::err_incomplete_type))
+ return true;
+
CXXCastPath BasePath;
DeclAccessPair BasePair =
findDecomposableBaseClass(S, Src->getLocation(), OrigRD, BasePath);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56974.183761.patch
Type: text/x-patch
Size: 1321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190127/e51e69da/attachment.bin>
More information about the cfe-commits
mailing list