When applying pragma packed in a struct definition, clang-tidy gives the following error:
Declaration of anonymous struct must be a definition - clang(anon_type_definition)
Declaration does not declare anything - clang(-Wmissing-declarations)
You can easily reproduce the error with the following code:
This only happens for MSVC, despite the code compiling and behaving correctly. In Visual Studio, with their static analysis, it does not even display an error. The error does not occur with the following code:
And the behavior is as expected. It only occurs if pragma is placed right after struct. The way I'm using it may be obtuse, but that is a way to guarantee the same behavior accross GCC-based compilers and MSVC.
When applying pragma packed in a struct definition, clang-tidy gives the following error: Declaration of anonymous struct must be a definition - clang(anon_type_definition) Declaration does not declare anything - clang(-Wmissing-declarations)
You can easily reproduce the error with the following code:
This only happens for MSVC, despite the code compiling and behaving correctly. In Visual Studio, with their static analysis, it does not even display an error. The error does not occur with the following code:
And the behavior is as expected. It only occurs if
pragma
is placed right afterstruct
. The way I'm using it may be obtuse, but that is a way to guarantee the same behavior accross GCC-based compilers and MSVC.