This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/81885] operator-> not checked by -D_GLIBCXX_ASSERTIONS
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 18 Aug 2017 13:22:31 +0000
- Subject: [Bug libstdc++/81885] operator-> not checked by -D_GLIBCXX_ASSERTIONS
- Auto-submitted: auto-generated
- References: <bug-81885-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81885
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
In fact it's the idiomatic way to get a real pointer from any kind of smart
pointer, e.g. fancy pointers used by allocators (which don't necessarily have a
get member function).
There's even a proposal to standardize a helper utility for doing it, see
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0653r1.html
It might not be so common for unique_ptr but it's still not dangerous, or
deserving of an assertion. If the returned pointer is dereferenced you'll get a
segfault anyway, so the benefit of an assertion is minimal. It doesn't prevent
any bugs.