public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/58594] New: std::make_shared does not accept const types as parameters @ 2013-10-02 13:58 akim.demaille at gmail dot com 2013-10-02 14:42 ` [Bug libstdc++/58594] " redi at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: akim.demaille at gmail dot com @ 2013-10-02 13:58 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58594 Bug ID: 58594 Summary: std::make_shared does not accept const types as parameters Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: akim.demaille at gmail dot com The following piece of code works with 4.8, clang 3.3 and 3.4, but not 4.9. I expect the code to be right, and 4.9 to be wrong, but even if it were the converse, the location is useless: it's the end of the translation unit, not the location of the error. It works if I remove the const. Cheers! $ cat foo.cc #include <memory> int main() { const int f = 42; auto fp = std::make_shared<const int>(f); return 51; } $ g++-mp-4.8 --version g++-mp-4.8 (MacPorts gcc48 4.8.1_3) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++-mp-4.8 -Wall -std=c++11 foo.cc $ g++-mp-4.9 --version g++-mp-4.9 (MacPorts gcc49 4.9-20130915_0) 4.9.0 20130915 (experimental) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++-mp-4.9 -Wall -std=c++11 foo.cc In file included from /opt/local/include/gcc49/c++/bits/shared_ptr.h:52:0, from /opt/local/include/gcc49/c++/memory:82, from foo.cc:1: /opt/local/include/gcc49/c++/bits/shared_ptr_base.h: In instantiation of 'void* std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_M_get_deleter(const std::type_info&) [with _Tp = const int; _Alloc = std::allocator<int>; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]': foo.cc:9:1: required from here /opt/local/include/gcc49/c++/bits/shared_ptr_base.h:462:58: error: invalid conversion from 'const void*' to 'void*' [-fpermissive] return __ti == typeid(_Sp_make_shared_tag) ? _M_ptr() : nullptr; ^ Cheers! ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/58594] std::make_shared does not accept const types as parameters 2013-10-02 13:58 [Bug c++/58594] New: std::make_shared does not accept const types as parameters akim.demaille at gmail dot com @ 2013-10-02 14:42 ` redi at gcc dot gnu.org 2013-10-02 19:55 ` [Bug libstdc++/58594] [4.9 Regression] " redi at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: redi at gcc dot gnu.org @ 2013-10-02 14:42 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58594 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2013-10-02 Component|c++ |libstdc++ Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Mine ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/58594] [4.9 Regression] std::make_shared does not accept const types as parameters 2013-10-02 13:58 [Bug c++/58594] New: std::make_shared does not accept const types as parameters akim.demaille at gmail dot com 2013-10-02 14:42 ` [Bug libstdc++/58594] " redi at gcc dot gnu.org @ 2013-10-02 19:55 ` redi at gcc dot gnu.org 2013-10-02 19:56 ` redi at gcc dot gnu.org 2014-12-13 0:44 ` redi at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: redi at gcc dot gnu.org @ 2013-10-02 19:55 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58594 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Wed Oct 2 19:55:14 2013 New Revision: 203131 URL: http://gcc.gnu.org/viewcvs?rev=203131&root=gcc&view=rev Log: PR libstdc++/58594 * include/bits/shared_ptr_base.h (_Sp_counted_ptr_inplace::_M_get_deleter()): Cast away cv-quals. * testsuite/20_util/shared_ptr/creation/58594.cc: New. Added: trunk/libstdc++-v3/testsuite/20_util/shared_ptr/creation/58594.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/shared_ptr_base.h ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/58594] [4.9 Regression] std::make_shared does not accept const types as parameters 2013-10-02 13:58 [Bug c++/58594] New: std::make_shared does not accept const types as parameters akim.demaille at gmail dot com 2013-10-02 14:42 ` [Bug libstdc++/58594] " redi at gcc dot gnu.org 2013-10-02 19:55 ` [Bug libstdc++/58594] [4.9 Regression] " redi at gcc dot gnu.org @ 2013-10-02 19:56 ` redi at gcc dot gnu.org 2014-12-13 0:44 ` redi at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: redi at gcc dot gnu.org @ 2013-10-02 19:56 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58594 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |FIXED Target Milestone|--- |4.9.0 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- fixed ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/58594] [4.9 Regression] std::make_shared does not accept const types as parameters 2013-10-02 13:58 [Bug c++/58594] New: std::make_shared does not accept const types as parameters akim.demaille at gmail dot com ` (2 preceding siblings ...) 2013-10-02 19:56 ` redi at gcc dot gnu.org @ 2014-12-13 0:44 ` redi at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: redi at gcc dot gnu.org @ 2014-12-13 0:44 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58594 --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Sat Dec 13 00:44:17 2014 New Revision: 218698 URL: https://gcc.gnu.org/viewcvs?rev=218698&root=gcc&view=rev Log: PR libstdc++/58594 * include/bits/shared_ptr_base.h: Real fix for cv-qualified types. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/shared_ptr_base.h ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-12-13 0:44 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-10-02 13:58 [Bug c++/58594] New: std::make_shared does not accept const types as parameters akim.demaille at gmail dot com 2013-10-02 14:42 ` [Bug libstdc++/58594] " redi at gcc dot gnu.org 2013-10-02 19:55 ` [Bug libstdc++/58594] [4.9 Regression] " redi at gcc dot gnu.org 2013-10-02 19:56 ` redi at gcc dot gnu.org 2014-12-13 0:44 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).