@@ -1439,31 +1439,20 @@ class CXXRecordDecl : public RecordDecl {
1439
1439
1440
1440
// / Determine whether this class is a literal type.
1441
1441
// /
1442
- // / C++11 [basic.types]p10:
1442
+ // / C++20 [basic.types]p10:
1443
1443
// / A class type that has all the following properties:
1444
- // / - it has a trivial destructor
1445
- // / - every constructor call and full-expression in the
1446
- // / brace-or-equal-intializers for non-static data members (if any) is
1447
- // / a constant expression.
1448
- // / - it is an aggregate type or has at least one constexpr constructor
1449
- // / or constructor template that is not a copy or move constructor, and
1450
- // / - all of its non-static data members and base classes are of literal
1451
- // / types
1452
- // /
1453
- // / We resolve DR1361 by ignoring the second bullet. We resolve DR1452 by
1454
- // / treating types with trivial default constructors as literal types.
1455
- // /
1456
- // / Only in C++17 and beyond, are lambdas literal types.
1457
- bool isLiteral () const {
1458
- const LangOptions &LangOpts = getLangOpts ();
1459
- return (LangOpts.CPlusPlus20 ? hasConstexprDestructor ()
1460
- : hasTrivialDestructor ()) &&
1461
- (!isLambda () || LangOpts.CPlusPlus17 ) &&
1462
- !hasNonLiteralTypeFieldsOrBases () &&
1463
- (isAggregate () || isLambda () ||
1464
- hasConstexprNonCopyMoveConstructor () ||
1465
- hasTrivialDefaultConstructor ());
1466
- }
1444
+ // / - it has a constexpr destructor
1445
+ // / - all of its non-static non-variant data members and base classes
1446
+ // / are of non-volatile literal types, and it:
1447
+ // / - is a closure type
1448
+ // / - is an aggregate union type that has either no variant members
1449
+ // / or at least one variant member of non-volatile literal type
1450
+ // / - is a non-union aggregate type for which each of its anonymous
1451
+ // / union members satisfies the above requirements for an aggregate
1452
+ // / union type, or
1453
+ // / - has at least one constexpr constructor or constructor template
1454
+ // / that is not a copy or move constructor.
1455
+ bool isLiteral () const ;
1467
1456
1468
1457
// / Determine whether this is a structural type.
1469
1458
bool isStructural () const {
0 commit comments