This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/21972] New: assert macro requires operator== (int) for its argument type


https://sourceware.org/bugzilla/show_bug.cgi?id=21972

            Bug ID: 21972
           Summary: assert macro requires operator== (int) for its
                    argument type
           Product: glibc
           Version: 2.26
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

After the fix for bug 21242, the assert macro implementation requires that the
argument can be compared to 0, which breaks the following code:

#include <assert.h>

struct S {
  explicit operator bool() const;
};

void f(S &s)
{
  assert (s);
}

The C++ standard is inconsistent due to its C standard import, but we should
fix this as a QoI issue.  Using static_cast<bool> (expr) instead is sufficient.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]