PR33489: A function-style cast to a deduced class template specialization type is type-dependent if it can't be resolved due to a type-dependent argument.

llvm-svn: 310691
This commit is contained in:
Richard Smith 2017-08-11 02:04:19 +00:00
parent 8d7bdf6dff
commit 0887754110
2 changed files with 26 additions and 1 deletions

View File

@ -1052,7 +1052,9 @@ CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(TypeSourceInfo *Type,
:Type->getType()->isRValueReferenceType()? VK_XValue
:VK_RValue),
OK_Ordinary,
Type->getType()->isDependentType(), true, true,
Type->getType()->isDependentType() ||
Type->getType()->getContainedDeducedType(),
true, true,
Type->getType()->containsUnexpandedParameterPack()),
Type(Type),
LParenLoc(LParenLoc),

View File

@ -286,6 +286,29 @@ namespace tuple_tests {
}
}
namespace dependent {
template<typename T> struct X {
X(T);
};
template<typename T> int Var(T t) {
X x(t);
return X(x) + 1; // expected-error {{invalid operands}}
}
template<typename T> int Cast(T t) {
return X(X(t)) + 1; // expected-error {{invalid operands}}
}
template<typename T> int New(T t) {
return X(new X(t)) + 1; // expected-error {{invalid operands}}
};
template int Var(float); // expected-note {{instantiation of}}
template int Cast(float); // expected-note {{instantiation of}}
template int New(float); // expected-note {{instantiation of}}
template<typename T> int operator+(X<T>, int);
template int Var(int);
template int Cast(int);
template int New(int);
}
#else
// expected-no-diagnostics