This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

std::aligned_storage and [[gnu::may_alias]]


Does std::aligned_storage need a [[gnu::may_alias]] attribute?


According to http://en.cppreference.com/w/cpp/language/reinterpret_cast#Type_aliasing, it is not legal to cast a char array into another type (that is not a relative of char*).


According to the example in http://en.cppreference.com/w/cpp/types/aligned_storage, it's perfectly all right to cast std::aligned_storage::data to some arbitrary T; and it would be hard to find a use for aligned_storage without it.


std::function uses [[gnu::may_alias]] in a situation where std::aligned_storage may be used.


Is this a problem in libstdc++, the standard, or my understanding of the strict aliasing rules?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]