https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106974
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> --- Code: #include <vector> #include <cstdio> template <typename NumType> struct __attribute__ ((__packed__)) Shard { NumType data[128]; }; template<typename NumType> class TestVector { public: TestVector() { shard_index_.push_back(Shard<NumType>()); } const NumType& operator[](int i) const { return shard_index_[0].data[0]; } private: std::vector<Shard<NumType>> shard_index_; }; int main(){ TestVector<unsigned int> vec; printf("%u\n",vec[0]); return 0; }