Boost logo

Boost :

Subject: Re: [boost] [concept] forward declarations and `BOOST_CONCEPT_REQUIRES()`
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2010-08-10 17:20:56


Please note that NDEBUG controls the assert() macro. NDEBUG can be defined or undefined by the user at will, even repeatedly within a translation unit (see C99 7.2/1).

_DEBUG is defined by VC when compiling in debug mode (with the /MTd or /MDd options), and not when compiling in release mode (with the /MT or /MD options). It must not be defined or undefined by the user. (Technically, defining it when it's already defined, and vice versa, is harmless, but the user shouldn't do that. The IDE does that for its own reasons.)

Despite their similar names, NDEBUG and _DEBUG are totally different. It sounds like you shouldn't be testing NDEBUG here.

(If VC10, aka 1600, is doing something wrong here, I'd like to know about it - with a self-contained repro.)

Stephan T. Lavavej
Visual C++ Libraries Developer

-----Original Message-----
From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Stefan van Kessel
Sent: Tuesday, August 10, 2010 2:02 PM
To: boost_at_[hidden]
Subject: Re: [boost] [concept] forward declarations and `BOOST_CONCEPT_REQUIRES()`

On 8/10/2010 10:05 PM, Lorenzo Caminiti wrote:
> On Mon, Aug 9, 2010 at 10:00 PM, Dave Abrahams<dave_at_[hidden]> wrote:
>> Just from looking at the error message this would seem to be a
>> cut-and-dried case of bugs in the compiler. The "overloads" it is
>> saying are ambiguous are identical, meaning they're really just one
>> thing.
>
> Yes, I noticed the same thing. I cannot try the code on other
> compilers at the moment, it would be great if anyone from this mailing
> list could do that and let me know...
>
> Even assuming this is a MSVC bug, is there a workaround for it?
>

For what it's worth. On MSVC10 your code only fails to build in Debug
mode for me. There's a Workaround already in requires.hpp that only
triggers if BOOST_MSVC < 1300 or #ifdef(NDEBUG). Adding ||
BOOST_WORKAROUND(BOOST_MSVC, == 1600) (obviously 1600 is my _MSC_VER)
gets rid of the problem for me. I don't know why the workaround has been
disabled for debug builds and I don't know if enabling it that way
wreaks havoc somewhere else.

Have a nice day,
Stefan

#if defined(NDEBUG) || BOOST_WORKAROUND(BOOST_MSVC, < 1300) ||
BOOST_WORKAROUND(BOOST_MSVC, == 1600)

# define BOOST_CONCEPT_REQUIRES(models, result)
            \
     typename
::boost::parameter::aux::unaryfunptr_arg_type<void(*)result>::type

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk