You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<source>:7:50: error: macro "assert" passed 2 arguments, but takes just 1
7 | void assert (bool pass, const char *test_name)
| ^
In file included from /opt/compiler-explorer/gcc-10.2.0/include/c++/10.2.0/cassert:44,
from /opt/compiler-explorer/libs/fmt/trunk/include/fmt/format-inl.h:12,
from /opt/compiler-explorer/libs/fmt/trunk/include/fmt/format.h:4230,
from <source>:2:
/usr/include/assert.h:92: note: macro "assert" defined here
92 | # define assert(expr) \
|
<source>:16:31: error: macro "assert" passed 2 arguments, but takes just 1
16 | test.assert(true, "mumble");
| ^
In file included from /opt/compiler-explorer/gcc-10.2.0/include/c++/10.2.0/cassert:44,
from /opt/compiler-explorer/libs/fmt/trunk/include/fmt/format-inl.h:12,
from /opt/compiler-explorer/libs/fmt/trunk/include/fmt/format.h:4230,
from <source>:2:
/usr/include/assert.h:92: note: macro "assert" defined here
92 | # define assert(expr) \
|
<source>:7:10: error: variable or field 'assert' declared void
7 | void assert (bool pass, const char *test_name)
| ^~~~~~
<source>:10:5: error: expected ';' at end of member declaration
10 | }
| ^
| ;
<source>: In function 'int main()':
<source>:16:10: error: 'struct Test' has no member named 'assert'
16 | test.assert(true, "mumble");
| ^~~~~~
As a workaround we can #undef assert immediately after including format.h.
It looks like some work was done to remove the dependency on cassert in 2f9acd1, but this did not extend to the header only mode?
Is it just a matter of replacing the remaining assert() calls with FMT_ASSERT()?
The text was updated successfully, but these errors were encountered:
* Don't include <cassert>. (#2148)
This commit replaces use of the assert() macro in format-inl.h with
FMT_ASSERT(). This allows us to drop the cassert include.
* FMT_GCC_VERSION is not defined when we include test-assert.h, use __GCC__ instead.
* Don't explicitly suppress GCC's -Wterminate in tests' FMT_ASSERT.
Throwing from a separate function is enough to silence the warning, no need to
explicitly suppress it.
* Remove messages from assertions added in 2f699d2.
* Correct formatting around throw_assertion_failure().
Consider the following example:
It fails compilation (godbolt) with:
As a workaround we can
#undef assert
immediately after includingformat.h
.It looks like some work was done to remove the dependency on cassert in 2f9acd1, but this did not extend to the header only mode?
Is it just a matter of replacing the remaining
assert()
calls withFMT_ASSERT()
?The text was updated successfully, but these errors were encountered: