Mercurial > illumos > git > illumos-gate
view usr/src/tools/smatch/src/validation/constexpr-offsetof.c @ 19241:79022555a4a9
11972 resync smatch
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Approved by: Dan McDonald <danmcd@joyent.com>
author | John Levon <john.levon@joyent.com> |
---|---|
date | Mon, 11 Nov 2019 16:23:50 +0000 |
parents | b73b4fe381d3 |
children |
line wrap: on
line source
struct A { int a[1]; int b; }; extern int c; static int o[] = { [__builtin_offsetof(struct A, b)] = 0, // OK [__builtin_offsetof(struct A, a[0])] = 0, // OK [__builtin_offsetof(struct A, a[0*0])] = 0, // OK [__builtin_offsetof(struct A, a[c])] = 0 // KO }; /* * check-name: constexprness __builtin_offsetof() * * check-error-start constexpr-offsetof.c:12:39: error: bad constant expression * check-error-end */