This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/21972] New: assert macro requires operator== (int) for its argument type
- From: "fweimer at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 18 Aug 2017 14:52:45 +0000
- Subject: [Bug libc/21972] New: assert macro requires operator== (int) for its argument type
- Auto-submitted: auto-generated
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.