[Bug libstdc++/67503] String cannot be loaded from binary representation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67503 --- Comment #10 from radventure at yandex dot ru --- (In reply to radventure from comment #9) > I understand the "small string optimization" idea. I agree about allocation > counting. But I don't see space economy, now sizeof(string) is 28 bytes in > 32-bit environment instead of 4 bytes early. Now sizeof(string) is 24 bytes.
[Bug libstdc++/67503] String cannot be loaded from binary representation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67503 --- Comment #9 from radventure at yandex dot ru --- I understand the "small string optimization" idea. I agree about allocation counting. But I don't see space economy, now sizeof(string) is 28 bytes in 32-bit environment instead of 4 bytes early.
[Bug libstdc++/67503] String cannot be loaded from binary representation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67503 --- Comment #6 from radventure at yandex dot ru --- (In reply to Jonathan Wakely from comment #4) > (In reply to radventure from comment #3) > > I can solve the alignment but prbolem will not be fixed. > > I agree with remark about "non-trivial types" but this code works in > > previous gcc versions and works in visual c++ 2015. > > It was never valid before and it's not valid now. Just because it appeared > to work previously doesn't make it valid. Code validity it's great. But what about backward compatibility?
[Bug libstdc++/67503] String cannot be loaded from binary representation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67503 --- Comment #5 from radventure at yandex dot ru --- When you use local buffer for storing string value it not necessary to have pointer to it. And we can reduce the size of string by the syzeof(pointer).
[Bug libstdc++/67503] String cannot be loaded from binary representation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67503 radventure at yandex dot ru changed: What|Removed |Added Resolution|INVALID |WONTFIX
[Bug libstdc++/67503] String cannot be loaded from binary representation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67503 --- Comment #3 from radventure at yandex dot ru --- I can solve the alignment but prbolem will not be fixed. I agree with remark about "non-trivial types" but this code works in previous gcc versions and works in visual c++ 2015.
[Bug libstdc++/67503] New: String cannot be loaded from binary representation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67503 Bug ID: 67503 Summary: String cannot be loaded from binary representation Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: radventure at yandex dot ru Target Milestone: --- #include #include int main() { unsigned char buff1[sizeof(std::string)], buff2[sizeof(std::string)]; std::string s1("SMAL STRING BUG"), s2; new (&buff1) std::string(s1); s2 = *(reinterpret_cast(&buff1)); std::cout << s2 << std::endl; std::swap(buff1, buff2); s2 = *(reinterpret_cast(&buff2)); std::cout << s2 << std::endl; } After swapping buffers _N_dataplus._M_p pointer points into we buff1 but actual data stored in small local buffer was coped correctly. If initial string length will be greater when data will be stored into the heap and everything will be Ok.
[Bug c++/67270] internal compiler error: in unify, at cp/pt.c:18178
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67270 --- Comment #2 from radventure at yandex dot ru --- (In reply to Marek Polacek from comment #1) > This was fixed in r219557 and is fixed in 5/trunk. I know about absence of problem in 5.1.
[Bug c++/67270] New: internal compiler error: in unify, at cp/pt.c:18178
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67270 Bug ID: 67270 Summary: internal compiler error: in unify, at cp/pt.c:18178 Product: gcc Version: 4.9.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: radventure at yandex dot ru Target Milestone: --- Code listed below crashes compiler I compile it with g++ -std=c++11 test.cpp #include template class C, typename... T> void g(const C& a) { } int main() { g({1, 2, 3}); }
[Bug c++/65312] Implicitly-declared default constructor must be defined as deleted
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65312 --- Comment #5 from radventure at yandex dot ru --- (In reply to Marek Polacek from comment #4) > Looks like this PR could be resolved as a NOTABUG? Agree
[Bug c++/65312] Implicitly-declared default constructor must be defined as deleted
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65312 --- Comment #2 from radventure at yandex dot ru --- (In reply to Jonathan Wakely from comment #1) > I believe this is a GCC extension, G++ implements the proposed resolution of > http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#253 and since > all sub-objects of List are correctly initialized, no initializer is > required for the member of that type. Ok. Other question on a little bit another code. Why generated output so dramatically changed when I removed initializer of 'data' member of Array struct (//Here commented) #include #include constexpr uint64_t Fib(uint32_t i) { return (i < 2)? i: (Fib(i - 1) + Fib(i - 2)); } template struct List { const uint64_t val = Fib(Z - N); const List next{}; }; template struct List { const uint64_t value = Fib(Z - 0); }; template struct Array { const List data{}; //Here const uint64_t *table = reinterpret_cast(&data); constexpr uint32_t size() const { return Z; } }; Array<20u> array; int main() { for (uint32_t i(0); i < array.size(); ++i) std::cout << array.table[i] << " "; }
[Bug c++/65312] New: Implicitly-declared default constructor must be defined as deleted
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65312 Bug ID: 65312 Summary: Implicitly-declared default constructor must be defined as deleted Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: radventure at yandex dot ru I think the next code should not be successfully compiled because of implicitly-declared default constructor of Array struct should be deleted #include #include constexpr uint64_t Fib(uint32_t i) { return (i < 2)? i: (Fib(i - 1) + Fib(i - 2)); } template struct List { const uint64_t val = Fib(Z - N); List next; }; template struct List { const uint64_t value = Fib(Z - 0); }; template struct Array { const List data; const uint64_t *table = reinterpret_cast(&data); constexpr uint32_t size() const { return Z; } }; Array<20u> array; int main() { for (uint32_t i(0); i < array.size(); ++i) std::cout << array.table[i] << " "; }