forked from OSchip/llvm-project
PR13527: don't assert if a function is explicitly defaulted when it's already
been defined. llvm-svn: 161315
This commit is contained in:
parent
3cd1bcb358
commit
f716bb859b
|
@ -7483,6 +7483,7 @@ void Sema::CheckForFunctionRedefinition(FunctionDecl *FD) {
|
|||
else
|
||||
Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName();
|
||||
Diag(Definition->getLocation(), diag::note_previous_definition);
|
||||
FD->setInvalidDecl();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4552,7 +4552,8 @@ bool SpecialMemberDeletionInfo::shouldDeleteForAllConstMembers() {
|
|||
/// C++11 [class.copy]p23, and C++11 [class.dtor]p5.
|
||||
bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
|
||||
bool Diagnose) {
|
||||
assert(!MD->isInvalidDecl());
|
||||
if (MD->isInvalidDecl())
|
||||
return false;
|
||||
CXXRecordDecl *RD = MD->getParent();
|
||||
assert(!RD->isDependentType() && "do deletion after instantiation");
|
||||
if (!LangOpts.CPlusPlus0x || RD->isInvalidDecl())
|
||||
|
|
|
@ -117,3 +117,35 @@ namespace DefaultedFnExceptionSpec {
|
|||
};
|
||||
OdrUse use; // expected-note {{implicit default constructor for 'DefaultedFnExceptionSpec::OdrUse' first required here}}
|
||||
}
|
||||
|
||||
namespace PR13527 {
|
||||
struct X {
|
||||
X() = delete; // expected-note {{here}}
|
||||
X(const X&) = delete; // expected-note {{here}}
|
||||
X(X&&) = delete; // expected-note {{here}}
|
||||
X &operator=(const X&) = delete; // expected-note {{here}}
|
||||
X &operator=(X&&) = delete; // expected-note {{here}}
|
||||
~X() = delete; // expected-note {{here}}
|
||||
};
|
||||
X::X() = default; // expected-error {{redefinition}}
|
||||
X::X(const X&) = default; // expected-error {{redefinition}}
|
||||
X::X(X&&) = default; // expected-error {{redefinition}}
|
||||
X &X::operator=(const X&) = default; // expected-error {{redefinition}}
|
||||
X &X::operator=(X&&) = default; // expected-error {{redefinition}}
|
||||
X::~X() = default; // expected-error {{redefinition}}
|
||||
|
||||
struct Y {
|
||||
Y() = default;
|
||||
Y(const Y&) = default;
|
||||
Y(Y&&) = default;
|
||||
Y &operator=(const Y&) = default;
|
||||
Y &operator=(Y&&) = default;
|
||||
~Y() = default;
|
||||
};
|
||||
Y::Y() = default; // expected-error {{definition of explicitly defaulted}}
|
||||
Y::Y(const Y&) = default; // expected-error {{definition of explicitly defaulted}}
|
||||
Y::Y(Y&&) = default; // expected-error {{definition of explicitly defaulted}}
|
||||
Y &Y::operator=(const Y&) = default; // expected-error {{definition of explicitly defaulted}}
|
||||
Y &Y::operator=(Y&&) = default; // expected-error {{definition of explicitly defaulted}}
|
||||
Y::~Y() = default; // expected-error {{definition of explicitly defaulted}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue