Subject: [Boost-bugs] [Boost C++ Libraries] #5810: BOOST_STATIC_ASSERT requires unnecessary parentheses
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-24 12:01:49
#5810: BOOST_STATIC_ASSERT requires unnecessary parentheses
------------------------------+---------------------------------------------
Reporter: tsoae@⦠| Owner: johnmaddock
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: static_assert
Version: Boost 1.47.0 | Severity: Cosmetic
Keywords: |
------------------------------+---------------------------------------------
In Boost 1.47.0 the BOOST_STATIC_ASSERT macro is defined as having one
parameter. When the argument contains comma-separated template arguments,
we (sometimes) have to use additional parentheses:
BOOST_STATIC_ASSERT(is_base_of<B, D>::value); /* error: two arguments
passed */
BOOST_STATIC_ASSERT((is_base_of<B, D>::value)); /* OK */
Today many C++ compilers support variadic macros, so for such compilers
BOOST_STATIC_ASSERT might be defined like this:
#ifndef BOOST_NO_STATIC_ASSERT
# define BOOST_STATIC_ASSERT(...) \
static_assert((__VA_ARGS__), #__VA_ARGS__)
#else
....
and BOOST_STATIC_ASSERT(is_base_of<B, D>::value) might be correct. Are
there any problems with such definition?
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5810> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC