[c++17] If a class inherits virtual functions from a base class, it is
not an aggregtae. llvm-svn: 334763
This commit is contained in:
parent
0c09acd32d
commit
c00e44656d
|
@ -259,9 +259,13 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases,
|
|||
// C++ [class.virtual]p1:
|
||||
// A class that declares or inherits a virtual function is called a
|
||||
// polymorphic class.
|
||||
if (BaseClassDecl->isPolymorphic())
|
||||
if (BaseClassDecl->isPolymorphic()) {
|
||||
data().Polymorphic = true;
|
||||
|
||||
// An aggregate is a class with [...] no virtual functions.
|
||||
data().Aggregate = false;
|
||||
}
|
||||
|
||||
// C++0x [class]p7:
|
||||
// A standard-layout class is a class that: [...]
|
||||
// -- has no non-standard-layout base classes
|
||||
|
|
|
@ -111,6 +111,11 @@ struct NonAggr6 { // expected-note 3 {{candidate constructor}}
|
|||
};
|
||||
NonAggr6 na6 = { 42 }; // expected-error {{no matching constructor for initialization of 'NonAggr6'}}
|
||||
|
||||
struct NonAggr7 : NonAggr6 { // expected-note 3 {{candidate constructor}}
|
||||
int n;
|
||||
};
|
||||
NonAggr7 na7 = {{}, 42}; // expected-error {{no matching constructor for initialization of 'NonAggr7'}}
|
||||
|
||||
struct DefaultedAggr {
|
||||
int n;
|
||||
|
||||
|
|
Loading…
Reference in New Issue