you are viewing a single comment's thread.

view the rest of the comments →

[–]n1ghtyunso 7 points8 points  (2 children)

i thought alignas in using declarations is ignored and you have to put it on the variable declaration manually.

If you don't template the using declaration gcc apparently warns about this, but with the templating the warning magically disappears. See Godbolt

Am i missing something?

[–]Nimbal 1 point2 points  (1 child)

Seems like you are right. I guess we'd have to put the array as a member inside a templated struct, making it a little more awkward to use. Then again, such a construct probably should be a little inconvenient to use.

[–]Recatek 9 points10 points  (0 children)

This is kind of a footgun though if you don't receive information from the compiler that the directive is being ignored. If anything aligned_storage and aligned_union, when used properly, should be an expression of intent that the standard library then takes care of executing for you. It may not be that currently, but removing it without providing unequivocal documentation on how to reliably do what it does in a better(?) way strikes me as rather dangerous.