I have a compilation error on clang and a warning with gcc with this code:
static alignas(16) int one_s = 1; // gcc: warning:attribute ignored; clang: error: an attribute list cannot appear here
static __attribute__((aligned(16))) int zero_s = 0; // on the other hand this works well on both compilers...
alignas(16) int one = 1; // this also works on both compilers
__attribute__((aligned(16))) int zero = 0; // as well as this
Does anyone know why alignas is not accepted in the declaration that contains the static keyword? I used the --std=c++11 compiler option with both gcc and clang.
Note that when compiling with visual studio I don't get an error when using alignas in a static declaration like that.
Aucun commentaire:
Enregistrer un commentaire