Add two tests which show our error handling behavior for invalid
parameters in the layout_version and empty_bases attributes.
Amend our documentation to make it more clear that
__declspec(empty_bases) and __declspec(layout_version) can only apply to
classes, structs, and unions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270461
91177308-0d34-0410-b5e6-
96231b3b80d8
let Content = [{
The empty_bases attribute permits the compiler to utilize the
empty-base-optimization more frequently.
+This attribute only applies to struct, class, and union types.
It is only supported when using the Microsoft C++ ABI.
}];
}
let Content = [{
The layout_version attribute requests that the compiler utilize the class
layout rules of a particular compiler version.
+This attribute only applies to struct, class, and union types.
It is only supported when using the Microsoft C++ ABI.
}];
}
int __declspec(empty_bases) I; // expected-warning{{'empty_bases' attribute only applies to classes}}
typedef struct T __declspec(empty_bases) U; // expected-warning{{'empty_bases' attribute only applies to classes}}
auto z = []() __declspec(empty_bases) { return nullptr; }; // expected-warning{{'empty_bases' attribute only applies to classes}}
+
+struct __declspec(empty_bases(1)) X {}; // expected-error{{'empty_bases' attribute takes no arguments}}
struct __declspec(layout_version(18)) X {}; // expected-error{{'layout_version' attribute parameter 18 is out of bounds}}
struct __declspec(layout_version(20)) Y {}; // expected-error{{'layout_version' attribute parameter 20 is out of bounds}}
+struct __declspec(layout_version) Z {}; // expected-error{{attribute takes one argument}}