forked from OSchip/llvm-project
When we're synthesizing copy/move-assignment, we can't form a reference to an
invalid field; make sure we don't try. Fixes <rdar://problem/14084171>. llvm-svn: 183479
This commit is contained in:
parent
8d6151fd29
commit
c9817fdf16
|
@ -8931,7 +8931,12 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
|
|||
Field != FieldEnd; ++Field) {
|
||||
if (Field->isUnnamedBitfield())
|
||||
continue;
|
||||
|
||||
|
||||
if (Field->isInvalidDecl()) {
|
||||
Invalid = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for members of reference type; we can't copy those.
|
||||
if (Field->getType()->isReferenceType()) {
|
||||
Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign)
|
||||
|
@ -9386,6 +9391,11 @@ void Sema::DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
|
|||
if (Field->isUnnamedBitfield())
|
||||
continue;
|
||||
|
||||
if (Field->isInvalidDecl()) {
|
||||
Invalid = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for members of reference type; we can't move those.
|
||||
if (Field->getType()->isReferenceType()) {
|
||||
Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign)
|
||||
|
|
|
@ -89,3 +89,14 @@ namespace PR14838 {
|
|||
const function &r; // expected-note {{reference member declared here}}
|
||||
} af;
|
||||
}
|
||||
|
||||
namespace rdar14084171 {
|
||||
struct Point { // expected-note 3 {{candidate constructor}}
|
||||
double x;
|
||||
double y;
|
||||
};
|
||||
struct Sprite {
|
||||
Point location = Point(0,0); // expected-error {{no matching constructor for initialization of 'rdar14084171::Point'}}
|
||||
};
|
||||
void f(Sprite& x) { x = x; }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue