Re: [Boost-bugs] [Boost C++ Libraries] #2069: #elif behaviour in gcc 4.4 (was: compile mpl with gcc-4.4)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2069: #elif behaviour in gcc 4.4 (was: compile mpl with gcc-4.4)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-08-20 19:53:33

#2069: #elif behaviour in gcc 4.4
  Reporter: tim blechmann <tim_at_[hidden]> | Owner: no-maintainer
      Type: Bugs | Status: new
 Milestone: Boost 1.37.0 | Component: preprocessor
   Version: Boost 1.35.0 | Severity: Problem
Resolution: | Keywords:
Changes (by danieljames):

  * owner: agurtovoy => no-maintainer
  * component: mpl => preprocessor


 The following is copied from:

 A recent change to the development version of the gcc preprocessor
 changes the way it processes '#elif' directives and breaks a common
 use of the preprocessor library. We've already had reports of this
 causing problems in MPL, and it might also affect: variant,
 function_types, python, fusion, xpressive and phoenix. Details of the
 change are at:

 With this change, the argument to an '#elif' directive is processed
 even if a previous '#if'/'#elif' directive was true. This causes the
 example use of BOOST_PP_ITERATION_DEPTH to break:

 In this example, the first time the header is included,
 BOOST_PP_ITERATION_DEPTH is not yet defined, so it causes the
 develoment gcc to fail when the #elif directives are evaluated (which
 are skipped with existing versions, because the first #if directive
 evaluates to true).

 Looking at the standard, I think their interpretation is correct
 (although I'm not familiar with it and could be missing something) but
 it isn't clear that this was the intent of the authors. Any opinions
 on this?

 I think it's quite easy to work around, we can replace:

 // ....
 // ....
 // ....


 // ....
 // ....
 // ....
 # endif

 So that the calls to BOOST_PP_ITERATION_DEPTH are skipped - or we
 could just include the necessary header before including the file. But
 it does seem a pity that any code which uses this technique might need
 to be changed for gcc 4.4. We should probably write to them about this
 (it doesn't look like they realised this would be a problem), but I'm
 writing here first in case anyone has any ideas.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:58 UTC