forked from OSchip/llvm-project
Sema: Provide a valid source location when instantiating templates based on a CXXDefaultArgExpr.
Fixes PR13758. llvm-svn: 168521
This commit is contained in:
parent
9bb247813a
commit
90633e39fc
|
@ -795,6 +795,8 @@ public:
|
|||
return SourceRange();
|
||||
}
|
||||
|
||||
SourceLocation getExprLoc() const LLVM_READONLY { return Loc; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == CXXDefaultArgExprClass;
|
||||
}
|
||||
|
|
|
@ -2980,7 +2980,7 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
|
|||
S.IsDerivedFrom(From->getType(), ToType)))
|
||||
ConstructorsOnly = true;
|
||||
|
||||
S.RequireCompleteType(From->getLocStart(), ToType, 0);
|
||||
S.RequireCompleteType(From->getExprLoc(), ToType, 0);
|
||||
// RequireCompleteType may have returned true due to some invalid decl
|
||||
// during template instantiation, but ToType may be complete enough now
|
||||
// to try to recover.
|
||||
|
|
|
@ -303,3 +303,21 @@ namespace PR12581 {
|
|||
{
|
||||
}
|
||||
}
|
||||
|
||||
namespace PR13758 {
|
||||
template <typename T> struct move_from {
|
||||
T invalid; // expected-error {{field has incomplete type 'void'}}
|
||||
};
|
||||
template <class K>
|
||||
struct unordered_map {
|
||||
explicit unordered_map(int n = 42);
|
||||
unordered_map(move_from<K> other);
|
||||
};
|
||||
template<typename T>
|
||||
void StripedHashTable() {
|
||||
new unordered_map<void>(); // expected-note {{in instantiation of template class 'PR13758::move_from<void>' requested here}}
|
||||
}
|
||||
void tt() {
|
||||
StripedHashTable<int>(); // expected-note {{in instantiation of function template specialization 'PR13758::StripedHashTable<int>' requested here}}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue