Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jan 2024 09:41:01 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 276738] clang: static_assert conflicts with -std=c++98 -pedantic-errors
Message-ID:  <bug-276738-29464-lFWCVE41oM@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-276738-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-276738-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D276738

Warner Losh <imp@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |imp@FreeBSD.org

--- Comment #4 from Warner Losh <imp@FreeBSD.org> ---
For C, there's certain features that we try to make available in a compatib=
le
way to old standards (eg __restrict to compile it away). I think the logic
here's not right for old C++ standards.

So the trouble is that llvm's
/usr/include/c++/v1/__config
#    define static_assert(...) _Static_assert(__VA_ARGS__)
when compiling for < C++11 (at least that's my reading of it, it's a twisty
maze so it may be in a branch not taken. That's the only place I could see =
any
redirection that would be affected by the #undef in the example.

sys/cdefs.h defines _Static_assert in an old-school C way for C++ < C++11, =
so
this feature is visible, but badly implemented for C++.

I suspect that both from reading this code and the #undef in the example me=
ans
we should simply not define _Static_assert for C++ at all. The compiler will
either implement it or not, depending on its wishes and give an error if no=
t.
assert.h already tries to do the right thing by not defining it for C++ at =
all.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-276738-29464-lFWCVE41oM>