[cfe-commits] r147955 - in /cfe/trunk: lib/AST/DeclCXX.cpp test/CXX/special/class.copy/p13-0x.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Wed Jan 11 10:26:05 PST 2012
Author: rsmith
Date: Wed Jan 11 12:26:05 2012
New Revision: 147955
URL: http://llvm.org/viewvc/llvm-project?rev=147955&view=rev
Log:
constexpr: fix typo resulting in move constructors sometimes not being
implicitly marked constexpr when they should be.
Modified:
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/test/CXX/special/class.copy/p13-0x.cpp
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=147955&r1=147954&r2=147955&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Wed Jan 11 12:26:05 2012
@@ -243,7 +243,7 @@
data().HasTrivialMoveAssignment = false;
// C++11 [class.ctor]p6:
- // If that user-written default cosntructor would satisfy the
+ // If that user-written default constructor would satisfy the
// requirements of a constexpr constructor, the implicitly-defined
// default constructor is constexpr.
if (!BaseClassDecl->hasConstexprDefaultConstructor())
@@ -264,7 +264,7 @@
// would be ill-formed, the implicit move constructor generated for the
// derived class calls the base class' copy constructor.
data().DefaultedMoveConstructorIsConstexpr &=
- !BaseClassDecl->hasConstexprMoveConstructor();
+ BaseClassDecl->hasConstexprMoveConstructor();
else if (!BaseClassDecl->hasConstexprCopyConstructor())
data().DefaultedMoveConstructorIsConstexpr = false;
}
Modified: cfe/trunk/test/CXX/special/class.copy/p13-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.copy/p13-0x.cpp?rev=147955&r1=147954&r2=147955&view=diff
==============================================================================
--- cfe/trunk/test/CXX/special/class.copy/p13-0x.cpp (original)
+++ cfe/trunk/test/CXX/special/class.copy/p13-0x.cpp Wed Jan 11 12:26:05 2012
@@ -53,3 +53,8 @@
constexpr Constexpr4 c4a = { ncd };
constexpr Constexpr4 c4b = Constexpr4(c4a);
constexpr Constexpr4 c4c = Constexpr4(static_cast<Constexpr4&&>(const_cast<Constexpr4&>(c4b)));
+
+struct Constexpr5Base {};
+struct Constexpr5 : Constexpr5Base { constexpr Constexpr5() {} };
+constexpr Constexpr5 ce5move = Constexpr5();
+constexpr Constexpr5 ce5copy = ce5move;
More information about the cfe-commits
mailing list