Restricting this "extension" to array types maximizes our standards
conformance while not miscompiling real-world programs.
llvm-svn: 224215
const ValueDecl *Decl = GetLValueBaseDecl(Value);
if (Decl && isa<VarDecl>(Decl)) {
QualType Ty = Decl->getType();
- return Ty->isIncompleteType() || Decl->getASTContext().getTypeSize(Ty) == 0;
+ if (Ty->isArrayType())
+ return Ty->isIncompleteType() ||
+ Decl->getASTContext().getTypeSize(Ty) == 0;
}
return false;
}
extern void (*start[])();
extern void (*end[])();
static_assert(&start != &end, ""); // expected-error {{constant expression}}
+ static_assert(&start != nullptr, "");
struct Foo;
struct Bar {
static const Foo y;
};
static_assert(&Bar::x != nullptr, "");
- static_assert(&Bar::x != &Bar::y, ""); // expected-error {{constant expression}}
+ static_assert(&Bar::x != &Bar::y, "");
}
namespace PR21859 {