I don't know what you mean by "all existing definitions". BUILD_ASSERT
has a few definitions but only one of them matters in this case:
#elif defined(__cplusplus) && __cplusplus >= 201103L
#define BUILD_ASSERT(EXPR) static_assert(EXPR, "assertion failed")
The post you cite implies that adding []{...} to the definition above
would fix the problem. Is that correct?
On Wed, Dec 20, 2017 at 12:45:04AM +0000, Sairam Venugopal wrote:
> Hi Ben,
>
> I did consider updating the definition of BUILD_ASSERT, however, that would
> involve changing all existing definitions (even non-expression context).
> This issue is prevalent on both Linux and Windows when we start compiling in
> C++ 11.
>
> Associated post:
> https://stackoverflow.com/questions/31311748/is-there-any-way-to-slip-a-static-assert-into-an-expression-in-iso-c11
>
> The ideal fix would be to not use static_assert as an expression in C++11
> mode.
> Currently, we hit this issue here :
> https://github.com/openvswitch/ovs/blob/master/lib/unaligned.h#L172
>
> You can disregard this patch for the time being since we will need to fix
> this on both Linux and Windows.
>
> Thanks,
> Sairam
>
>
>
> On 12/19/17, 3:45 PM, "Ben Pfaff" <[email protected]> wrote:
>
> >On Tue, Dec 19, 2017 at 03:32:27PM -0800, Sairam Venugopal wrote:
> >> A static assert declaration may appear at block scope (as a block
> >> declaration) and inside a class body (as a member declaration). However,
> >> unlike sizeof, static_assert cannot be used as an expression and this is
> >> strictly enforced on MSVC. error C2059: syntax error : static_assert
> >>
> >> Signed-off-by: Sairam Venugopal <[email protected]>
> >
> >I'd really prefer to adjust the definition of BUILD_ASSERT so that it
> >can be used in any expression context. Did you consider that?
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev