Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Dec 2015 16:29:47 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-toolchain@FreeBSD.org
Subject:   [Bug 205453] 11.0-CURRENT libcxxrt/guard.cc uses C11's _Static_assert in conditionally-compiled C++ code and when it is used buildworld fails for syntax errors in g++ compilers
Message-ID:  <bug-205453-29464-7brLtnA4nP@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-205453-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-205453-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=205453

Dimitry Andric <dim@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bapt@FreeBSD.org,
                   |                            |dim@FreeBSD.org,
                   |                            |theraven@FreeBSD.org

--- Comment #2 from Dimitry Andric <dim@FreeBSD.org> ---
Hm, this _Static_assert has an interesting history.  The original review from
Baptiste, https://reviews.freebsd.org/D1390, used static_assert(), but this
required -std=c++11 to compile, otherwise you would get:

contrib/libcxxrt/guard.cc:104:1: error: C++ requires a type specifier for all
declarations
static_assert(sizeof(guard_t) == sizeof(uint64_t), "");
^~~~~~~~~~~~~

This is the version upstream eventually also used, since they apparently assume
C++11 there.  David suggested changing it to _Static_assert(): "This should
work if you change it to _Static_assert, which I think we support for all C/C++
versions."

Now that I look at the code again, I am not entirely sure why the static
assertion is only for the big endian #ifdef block.  It would seem more useful
to put it a few lines lower, for the !_LP64 case.

That said, even when moving the _Static_assert() like that, it compiles fine
for me, both with base gcc, and several versions of ports gcc (I tried gcc 4.8,
4.9 and 5.2).

On the other hand, your sample program indeed does not compile with the ports
versions of gcc.  I'm not sure where those versions are getting their version
of _Static_assert() from, though...

-- 
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-205453-29464-7brLtnA4nP>