[Bug libstdc++/58839] New: Regression: dereferencing void in shared_ptr(unique_ptr&& u) constructor
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58839 Bug ID: 58839 Summary: Regression: dereferencing void in shared_ptr(unique_ptr&& u) constructor Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: mrlika at gmail dot com This completely valid C++11 code does not compile when T is void. template void f() { std::unique_ptr sp; std::shared_ptr up(std::move(sp)); } int main() { f(); //f(); // Error /usr/include/c++/4.8/bits/shared_ptr_base.h:851:34: error: ‘std::unique_ptr >::pointer {aka void*}’ is not a pointer-to-object type } This bug makes impossible to use shared_ptr constructor that takes unique_ptr rvalue reference as a parameter with type of pointer T=void. This is regression appeared after changing line in shared_ptr_base.h from _Tp1* __tmp = __r.get(); to auto __tmp = std::__addressof(*__r.get()); in the following commit: 2012-11-07 paolo2012-11-07 Paolo Carlini
[Bug libstdc++/58839] Regression: dereferencing void* in shared_ptr(unique_ptr&& u) constructor
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58839 --- Comment #2 from Andriy Lysnevych --- Hi Paolo, You are right. It is not yours commit but next one. __r.get() returns T* and construction *__r.get() works for any type except the case when T=void. It causes dereferencing of void pointer that is prohibited by standard. When code creates unique_ptr a resource hidden behind void pointer (most likely with custom deleter functionality) and then tries to pass it to shared_ptr(unique_ptr&&) constructor we get this void dereferencing error. Regards
[Bug c++/70353] New: static_assert + assert + c++14 crashes GCC
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70353 Bug ID: 70353 Summary: static_assert + assert + c++14 crashes GCC Product: gcc Version: 5.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mrlika at gmail dot com Target Milestone: --- I use out-of-the-box GCC 5.2.1 in Ubuntu 15.10: gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2) This code makes GCC crash when I define standard --std=c++14 or --std=c++17: #include constexpr int ce(int r) { assert(r == 3); return r; } static_assert(ce(3) == 3, "static asser error"); Command to reproduce: $ gcc --std=c++14 bug.cpp bug.cpp:8:17: in constexpr expansion of ‘ce(3)’ bug.cpp:8:48: internal compiler error: Segmentation fault static_assert(ce(3) == 3, "static asser error"); ^ Please submit a full bug report, with preprocessed source if appropriate. See for instructions.
[Bug c++/70353] static_assert + assert + c++14 crashes GCC
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70353 --- Comment #3 from Andriy Lysnevych --- static_assert is not required. This code also crashes: #include constexpr int ce(int r) { assert(r == 3); return r; } const auto c = ce(3); Problem is in assert called from constexpr function.
[Bug c++/70353] [5/6 regression] ICE on __PRETTY_FUNCTION__ in a constexpr function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70353 --- Comment #8 from Andriy Lysnevych --- Smaller test case: constexpr const char* ce () { return __func__; } const char* c = ce ();