summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-09-26 19:00:16 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-09-26 19:00:16 +0000
commit79c88c31056fc52f8414c497f2d6e2e53749c48b (patch)
treee39d1f3a122dc10559f9d9863b6f3c44416aa40b /clang/lib/AST
parent8fe53c490a567d3e9337b974057a239477dbe685 (diff)
downloadbcm5719-llvm-79c88c31056fc52f8414c497f2d6e2e53749c48b.tar.gz
bcm5719-llvm-79c88c31056fc52f8414c497f2d6e2e53749c48b.zip
P1008R1 Classes with user-declared constructors are never aggregates in
C++20. llvm-svn: 343131
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/DeclCXX.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 5c708694913..00ae7c9cda1 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -731,9 +731,14 @@ void CXXRecordDecl::addedMember(Decl *D) {
}
// C++11 [dcl.init.aggr]p1: DR1518
- // An aggregate is an array or a class with no user-provided, explicit, or
- // inherited constructors
- if (Constructor->isUserProvided() || Constructor->isExplicit())
+ // An aggregate is an array or a class with no user-provided [or]
+ // explicit [...] constructors
+ // C++20 [dcl.init.aggr]p1:
+ // An aggregate is an array or a class with no user-declared [...]
+ // constructors
+ if (getASTContext().getLangOpts().CPlusPlus2a
+ ? !Constructor->isImplicit()
+ : (Constructor->isUserProvided() || Constructor->isExplicit()))
data().Aggregate = false;
}
OpenPOWER on IntegriCloud