The "/usr/include/assert.h" from FreeBSD causes C++ compilation to fail when an assertion is done and the compiler is non-GCC _and_ does not define "__GNUC__" _and_ "NDEBUG" is not defined. It`s a simple and quick fix. Fix: *** /usr/include/assert.h 2009-10-02 01:24:01.000000000 -0500 --- /tmp/assert.h___new 2011-08-28 21:39:12.000000000 -0500 *************** *** 66,72 **** __END_DECLS #define assert(e) \ ! ((void) ((e) ? 0 : __assert (#e, __FILE__, __LINE__))) #define __assert(e, file, line) \ ((void)printf ("%s:%u: failed assertion `%s'\n", file, line, e), abort()) --- 66,72 ---- __END_DECLS #define assert(e) \ ! ((void) ((e) ? ((void)0) : __assert (#e, __FILE__, __LINE__))) #define __assert(e, file, line) \ ((void)printf ("%s:%u: failed assertion `%s'\n", file, line, e), abort()) q Patch attached with submission follows: How-To-Repeat: compile this: #include <cassert> int main() { assert(1); } like this [assuming Clang is installed and is on the PATH]: clang++ -U__GNUC__ test.cpp and one of the errors you get is this: test.cpp:3:3: error: right operand to ? is void, but left operand is of type 'int' assert(1); ^~~~~~~~~ In file included from test.cpp:1: In file included from /usr/include/c++/4.2.1/cassert:48: /usr/include/assert.h:69:18: note: instantiated from: ((void) ((e) ? 0 : __assert (#e, __FILE__, __LINE__))) ^ ~
I don't think this is a FreeBSD bug, I've checked FreeBSD code revision history and we never shipped an assert.h with 0 not being properly casted to void. Your code will not compile on FreeBSD for another reason which we need to fix anyways, thanks for letting us know this! Cheers, -- Xin LI <delphij@delphij.net> https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die
For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped
Keyword: patch or patch-ready – in lieu of summary line prefix: [patch] * bulk change for the keyword * summary lines may be edited manually (not in bulk). Keyword descriptions and search interface: <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>