Closed triallax closed 3 months ago
e.g. with clang 18 on chimera linux:
_CFFI_test_verify_anonymous_struct_with_star_typedef.cpp:583:10: error: non-constant-expression cannot be narrowed from type 'long' to 'size_t' (aka 'unsigned long') in initializer list [-Wc++11-narrowing] 583 | { "a", ((char )&((foo_t)4096)->a) - (char )4096, | ^~~~~~~~~~ _CFFI_test_verify_anonymous_struct_with_star_typedef.cpp:583:10: note: insert an explicit cast to silence this issue 583 | { "a", ((char )&((foo_t)4096)->a) - (char )4096, | ^~~~~~~~~~ | static_cast( )
Thanks. The additional cast looks harmless and if it helps some compilers, then let's go for it.
e.g. with clang 18 on chimera linux:
_CFFI_test_verify_anonymous_struct_with_star_typedef.cpp:583:10: error: non-constant-expression cannot be narrowed from type 'long' to 'size_t' (aka 'unsigned long') in initializer list [-Wc++11-narrowing] 583 | { "a", ((char )&((foo_t)4096)->a) - (char )4096, | ^( )
~~~~~~~~~ _CFFI_test_verify_anonymous_struct_with_star_typedef.cpp:583:10: note: insert an explicit cast to silence this issue 583 | { "a", ((char )&((foo_t)4096)->a) - (char )4096, | ^~~~~~~~~~ | static_cast