aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/DeclCXX.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST/DeclCXX.h')
-rw-r--r--include/clang/AST/DeclCXX.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 7f3ec4c616..54d4d7b627 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -357,6 +357,9 @@ class CXXRecordDecl : public RecordDecl {
/// \brief True if there no non-field members declared by the user.
bool HasOnlyCMembers : 1;
+ /// \brief True if any field has an in-class initializer.
+ bool HasInClassInitializer : 1;
+
/// HasTrivialDefaultConstructor - True when, if this class has a default
/// constructor, this default constructor is trivial.
///
@@ -1040,6 +1043,10 @@ public:
/// no base classes, and no virtual functions (C++ [dcl.init.aggr]p1).
bool isAggregate() const { return data().Aggregate; }
+ /// hasInClassInitializer - Whether this class has any in-class initializers
+ /// for non-static data members.
+ bool hasInClassInitializer() const { return data().HasInClassInitializer; }
+
/// isPOD - Whether this class is a POD-type (C++ [class]p4), which is a class
/// that is an aggregate that has no non-static non-POD data members, no
/// reference data members, no user-defined copy assignment operator and no
@@ -1091,7 +1098,8 @@ public:
/// defaultedDefaultConstructorIsConstexpr - Whether a defaulted default
/// constructor for this class would be constexpr.
bool defaultedDefaultConstructorIsConstexpr() const {
- return data().DefaultedDefaultConstructorIsConstexpr;
+ return data().DefaultedDefaultConstructorIsConstexpr &&
+ (!isUnion() || hasInClassInitializer());
}
/// defaultedCopyConstructorIsConstexpr - Whether a defaulted copy
@@ -1111,7 +1119,7 @@ public:
bool hasConstexprDefaultConstructor() const {
return data().HasConstexprDefaultConstructor ||
(!data().UserDeclaredConstructor &&
- data().DefaultedDefaultConstructorIsConstexpr && isLiteral());
+ defaultedDefaultConstructorIsConstexpr() && isLiteral());
}
/// hasConstexprCopyConstructor - Whether this class has a constexpr copy