PR40674: fix assertion failure if a structured binding declaration has a

tuple-like decomposition that produces value-dependent reference
bindings.

llvm-svn: 369829
This commit is contained in:
Richard Smith 2019-08-24 01:23:57 +00:00
parent af47d0021c
commit 7a6182d48d
2 changed files with 9 additions and 2 deletions

View File

@ -1225,7 +1225,8 @@ static bool checkTupleLikeDecomposition(Sema &S,
if (E.isInvalid())
return true;
RefVD->setInit(E.get());
RefVD->checkInitIsICE();
if (!E.get()->isValueDependent())
RefVD->checkInitIsICE();
E = S.BuildDeclarationNameExpr(CXXScopeSpec(),
DeclarationNameInfo(B->getDeclName(), Loc),

View File

@ -127,7 +127,7 @@ void referenced_type() {
using ConstInt3 = decltype(bcr2);
}
struct C { template<int> int get(); };
struct C { template<int> int get() const; };
template<> struct std::tuple_size<C> { static const int value = 1; };
template<> struct std::tuple_element<0, C> { typedef int type; };
@ -138,6 +138,12 @@ int member_get() {
return c;
}
constexpr C c = C();
template<const C *p> void dependent_binding_PR40674() {
const auto &[c] = *p;
(void)c;
}
struct D {
// FIXME: Emit a note here explaining why this was ignored.
template<int> struct get {};