forked from OSchip/llvm-project
PR17615: A delegating constructor initializer is a full-expression. Don't
forget to clean up temporaries at the end of it. llvm-svn: 194213
This commit is contained in:
parent
faed9c671e
commit
9ff62af3aa
|
@ -3623,8 +3623,11 @@ static bool HandleConstructorCall(SourceLocation CallLoc, const LValue &This,
|
|||
// If it's a delegating constructor, just delegate.
|
||||
if (Definition->isDelegatingConstructor()) {
|
||||
CXXConstructorDecl::init_const_iterator I = Definition->init_begin();
|
||||
if (!EvaluateInPlace(Result, Info, This, (*I)->getInit()))
|
||||
return false;
|
||||
{
|
||||
FullExpressionRAII InitScope(Info);
|
||||
if (!EvaluateInPlace(Result, Info, This, (*I)->getInit()))
|
||||
return false;
|
||||
}
|
||||
return EvaluateStmt(Result, Info, Definition->getBody()) != ESR_Failed;
|
||||
}
|
||||
|
||||
|
|
|
@ -887,3 +887,14 @@ namespace Bitfields {
|
|||
}
|
||||
static_assert(test(), "");
|
||||
}
|
||||
|
||||
namespace PR17615 {
|
||||
struct A {
|
||||
int &&r;
|
||||
constexpr A(int &&r) : r(static_cast<int &&>(r)) {}
|
||||
constexpr A() : A(0) {
|
||||
(void)+r; // expected-note {{outside its lifetime}}
|
||||
}
|
||||
};
|
||||
constexpr int k = A().r; // expected-error {{constant expression}} expected-note {{in call to}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue