public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/57465] New: Failed postcondition for std::function constructed with null function pointer
@ 2013-05-30  9:49 redi at gcc dot gnu.org
  2013-05-30  9:49 ` [Bug libstdc++/57465] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-05-30  9:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57465

            Bug ID: 57465
           Summary: Failed postcondition for std::function constructed
                    with null function pointer
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

#include <functional>
#include <cassert>

int main()
{
  using F = void();
  F* f = nullptr;
  std::function<F> x(f);
  assert( !x );
}

The assert should pass, but it fails with all versions.

Note that clang++ with libstdc++ headers passes the test, so this might be a
front end bug (to be filed separately) but can be fixed/worked around easily
enough in libstdc++ like so:

--- functional.orig     2013-05-30 10:48:27.081623873 +0100
+++ functional  2013-05-30 10:48:29.225370770 +0100
@@ -1964,7 +1964,7 @@

        template<typename _Tp>
          static bool
-         _M_not_empty_function(const _Tp*& __fp)
+         _M_not_empty_function(_Tp* const& __fp)
          { return __fp; }

        template<typename _Class, typename _Tp>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-15 16:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30  9:49 [Bug libstdc++/57465] New: Failed postcondition for std::function constructed with null function pointer redi at gcc dot gnu.org
2013-05-30  9:49 ` [Bug libstdc++/57465] " redi at gcc dot gnu.org
2013-09-27 14:06 ` redi at gcc dot gnu.org
2013-09-27 14:09 ` redi at gcc dot gnu.org
2013-10-06 17:38 ` redi at gcc dot gnu.org
2013-10-06 17:39 ` redi at gcc dot gnu.org
2014-07-09 21:24 ` paolo.carlini at oracle dot com
2014-08-15 16:26 ` paolo.carlini at oracle dot com

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).