https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71766
Bug ID: 71766
Summary: Strange position of "error: request for member ‘...’
in something not a structure or union"
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: ch3root at openwall dot com
Target Milestone: ---
Only the first letter of 'offsetof' is shown in another color for the following
testcase.
Source code:
----------------------------------------------------------------------
#include <stddef.h>
int main()
{
+offsetof(int, a);
}
----------------------------------------------------------------------
Results:
----------------------------------------------------------------------
$ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out
In file included from test.c:1:0:
test.c: In function ‘main’:
test.c:5:4: error: request for member ‘a’ in something not a structure or union
+offsetof(int, a);
^
----------------------------------------------------------------------
gcc version: gcc (GCC) 7.0.0 20160704 (experimental)
For comparison:
----------------------------------------------------------------------
$ clang -std=c11 -Weverything -O3 test.c && ./a.out
test.c:5:4: error: offsetof requires struct, union, or class type, 'int'
invalid
+offsetof(int, a);
^ ~~~
.../lib/clang/3.9.0/include/stddef.h:120:24: note: expanded from macro
'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
^ ~
1 error generated.
----------------------------------------------------------------------
clang version: clang version 3.9.0 (trunk 274502)