forked from OSchip/llvm-project
Fix crash-on-invalid if list-initialization works, but we bail out when
building the resulting expression because it invokes a deleted constructor. llvm-svn: 182624
This commit is contained in:
parent
4814317516
commit
cd09065ec3
|
@ -5745,7 +5745,8 @@ InitializationSequence::Perform(Sema &S,
|
|||
ExprResult Res = S.PerformCopyInitialization(
|
||||
Element, Init.get()->getExprLoc(), Init,
|
||||
/*TopLevelOfInitList=*/ true);
|
||||
assert(!Res.isInvalid() && "Result changed since try phase.");
|
||||
if (Res.isInvalid())
|
||||
return ExprError();
|
||||
Converted[i] = Res.take();
|
||||
}
|
||||
InitListExpr *Semantic = new (S.Context)
|
||||
|
|
|
@ -208,3 +208,13 @@ namespace init_list_deduction_failure {
|
|||
void h() { g({f}); }
|
||||
// expected-error@-1 {{no matching function for call to 'g'}}
|
||||
}
|
||||
|
||||
namespace deleted_copy {
|
||||
struct X {
|
||||
X(int i) {}
|
||||
X(const X& x) = delete; // expected-note {{here}}
|
||||
void operator=(const X& x) = delete;
|
||||
};
|
||||
|
||||
std::initializer_list<X> x{1}; // expected-error {{invokes deleted constructor}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue