[cfe-commits] r137219 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CXX/special/class.copy/p15-0x.cpp
Douglas Gregor
dgregor at apple.com
Wed Aug 10 09:51:53 PDT 2011
Author: dgregor
Date: Wed Aug 10 11:51:53 2011
New Revision: 137219
URL: http://llvm.org/viewvc/llvm-project?rev=137219&view=rev
Log:
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.
Added:
cfe/trunk/test/CXX/special/class.copy/p15-0x.cpp (with props)
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=137219&r1=137218&r2=137219&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Aug 10 11:51:53 2011
@@ -2155,7 +2155,8 @@
BaseAndFieldInfo(Sema &S, CXXConstructorDecl *Ctor, bool ErrorsInInits)
: S(S), Ctor(Ctor), AnyErrorsInInits(ErrorsInInits) {
// FIXME: Handle implicit move constructors.
- if (Ctor->isImplicit() && Ctor->isCopyConstructor())
+ if ((Ctor->isImplicit() || Ctor->isDefaulted()) &&
+ Ctor->isCopyConstructor())
IIK = IIK_Copy;
else
IIK = IIK_Default;
Added: cfe/trunk/test/CXX/special/class.copy/p15-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.copy/p15-0x.cpp?rev=137219&view=auto
==============================================================================
--- cfe/trunk/test/CXX/special/class.copy/p15-0x.cpp (added)
+++ cfe/trunk/test/CXX/special/class.copy/p15-0x.cpp Wed Aug 10 11:51:53 2011
@@ -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);
+ }
+}
Propchange: cfe/trunk/test/CXX/special/class.copy/p15-0x.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/special/class.copy/p15-0x.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/special/class.copy/p15-0x.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list