From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17803 invoked by alias); 30 May 2013 09:49:37 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 17775 invoked by uid 48); 30 May 2013 09:49:33 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/57465] New: Failed postcondition for std::function constructed with null function pointer Date: Thu, 30 May 2013 09:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.7.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-05/txt/msg02086.txt.bz2 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 #include int main() { using F = void(); F* f = nullptr; std::function 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 static bool - _M_not_empty_function(const _Tp*& __fp) + _M_not_empty_function(_Tp* const& __fp) { return __fp; } template