We correctly forbid variables but not variable templates. Diagnose this
case instead of crashing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224905
91177308-0d34-0410-b5e6-
96231b3b80d8
if (BitWidth) {
if (Member->isInvalidDecl()) {
// don't emit another diagnostic.
- } else if (isa<VarDecl>(Member)) {
+ } else if (isa<VarDecl>(Member) || isa<VarTemplateDecl>(Member)) {
// C++ 9.6p3: A bit-field shall not be a static member.
// "static member 'A' cannot be a bit-field"
Diag(Loc, diag::err_static_not_bitfield)
// TODO:
}
+namespace bitfield {
+struct S {
+ template <int I>
+ static int f : I; // expected-error {{static member 'f' cannot be a bit-field}}
+};
+}