public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/57465] Failed postcondition for std::function constructed with null function pointer
  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 ` redi at gcc dot gnu.org
  2013-09-27 14:06 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-05-30
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1


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

* [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

* [Bug libstdc++/57465] Failed postcondition for std::function constructed with null function pointer
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-09-27 14:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Fri Sep 27 14:06:09 2013
New Revision: 202974

URL: http://gcc.gnu.org/viewcvs?rev=202974&root=gcc&view=rev
Log:
    PR libstdc++/57465
    * include/std/functional
    (_Function_base::_Base_manager::_M_not_empty_function): Fix overload
    for pointers.
    * testsuite/20_util/function/cons/57465.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/20_util/function/cons/57465.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/functional


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

* [Bug libstdc++/57465] Failed postcondition for std::function constructed with null function pointer
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-09-27 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on the trunk so far.


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

* [Bug libstdc++/57465] Failed postcondition for std::function constructed with null function pointer
  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
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-10-06 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Sun Oct  6 17:38:10 2013
New Revision: 203230

URL: http://gcc.gnu.org/viewcvs?rev=203230&root=gcc&view=rev
Log:
    PR libstdc++/57465
    * include/std/functional
    (_Function_base::_Base_manager::_M_not_empty_function): Fix overload
    for pointers.
    * testsuite/20_util/function/cons/57465.cc: New.

Added:
   
branches/gcc-4_8-branch/libstdc++-v3/testsuite/20_util/function/cons/57465.cc
Modified:
    branches/gcc-4_8-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_8-branch/libstdc++-v3/include/std/functional


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

* [Bug libstdc++/57465] Failed postcondition for std::function constructed with null function pointer
  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
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-10-06 17:39 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.8.2

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 4.8.2, I'm not planning to backport this to the 4.7 branch though.


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

* [Bug libstdc++/57465] Failed postcondition for std::function constructed with null function pointer
  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
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-07-09 21:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57465
Bug 57465 depends on bug 57466, which changed state.

Bug 57466 Summary: [DR 1584] Argument deduction fails for 'const T*' when T is function type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57466

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED


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

* [Bug libstdc++/57465] Failed postcondition for std::function constructed with null function pointer
  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
                   ` (5 preceding siblings ...)
  2014-07-09 21:24 ` paolo.carlini at oracle dot com
@ 2014-08-15 16:26 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-08-15 16:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57465
Bug 57465 depends on bug 57466, which changed state.

Bug 57466 Summary: [DR 1584] Argument deduction fails for 'const T*' when T is function type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57466

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---


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