forked from OSchip/llvm-project
When adding the base and member initializers for an implicitly-defined
special member function, make sure to classify an explicitly-defaulted copy constructor as a "copy" operation. Fixes PR10622. llvm-svn: 137219
This commit is contained in:
parent
349c403b46
commit
5c076db18e
|
@ -2155,7 +2155,8 @@ struct BaseAndFieldInfo {
|
||||||
BaseAndFieldInfo(Sema &S, CXXConstructorDecl *Ctor, bool ErrorsInInits)
|
BaseAndFieldInfo(Sema &S, CXXConstructorDecl *Ctor, bool ErrorsInInits)
|
||||||
: S(S), Ctor(Ctor), AnyErrorsInInits(ErrorsInInits) {
|
: S(S), Ctor(Ctor), AnyErrorsInInits(ErrorsInInits) {
|
||||||
// FIXME: Handle implicit move constructors.
|
// FIXME: Handle implicit move constructors.
|
||||||
if (Ctor->isImplicit() && Ctor->isCopyConstructor())
|
if ((Ctor->isImplicit() || Ctor->isDefaulted()) &&
|
||||||
|
Ctor->isCopyConstructor())
|
||||||
IIK = IIK_Copy;
|
IIK = IIK_Copy;
|
||||||
else
|
else
|
||||||
IIK = IIK_Default;
|
IIK = IIK_Default;
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
|
||||||
|
|
||||||
|
namespace PR10622 {
|
||||||
|
struct foo {
|
||||||
|
const int first;
|
||||||
|
foo(const foo&) = default;
|
||||||
|
};
|
||||||
|
void find_or_insert(const foo& __obj) {
|
||||||
|
foo x(__obj);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue