diff options
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 1bf1c1b4c4..0aab240a53 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -1052,11 +1052,13 @@ bool QualType::isTrivialType(ASTContext &Context) const { if (const RecordType *RT = CanonicalType->getAs<RecordType>()) { if (const CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) { - // C++0x [class]p5: - // A trivial class is a class that has a trivial default constructor - if (!ClassDecl->hasTrivialDefaultConstructor()) return false; - // and is trivially copyable. - if (!ClassDecl->isTriviallyCopyable()) return false; + // C++11 [class]p6: + // A trivial class is a class that has a default constructor, + // has no non-trivial default constructors, and is trivially + // copyable. + return ClassDecl->hasDefaultConstructor() && + !ClassDecl->hasNonTrivialDefaultConstructor() && + ClassDecl->isTriviallyCopyable(); } return true; |