[Patch] [libstdc++] [constexpr] use macros in place of 'constexpr' to allow for disabling constexpr until fully supported by compiler

Paolo Carlini paolo.carlini@oracle.com
Thu Feb 17 16:16:00 GMT 2011


On 02/17/2011 03:06 PM, Adam Butcher wrote:
> Hi,
>
> The attached patch replaces occurrences of the plain word 'constexpr'
> with either the symbol _GLIBCXX_CONSTEXPR or the symbol
> _GLIBCXX_USE_CONSTEXPR, depending on whether the disabled replacement
> should be '' or 'const' respectively.
>
> This allows for disabling constexpr usage by the standard library in
> C++0x mode until issues such as
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47774 /
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46472 are resolved in the
> compiler.
>
> Note I have only changed files required to build the project I'm
> currently working on.  Specifically std/limits and std/complex.  There
> may be other occurrences of the plain word 'constexpr' that are not
> referenced by it.
>   
Please always send library patches to the libstdc++ mailing list too
(and of course, at some point you will need a Copyright Assignment on
file...)

Anyway, about the technical point: currently the macros are just an
implementation detail, are *not* meant to be changed at will be the user
(among other things, note that they appear in *.cc files too...).
Anyway, if we are going to do what you are suggesting we have to do it
consistently everywhere and document it.

At the moment, I don't know *exactly* how serious are the front-end
issues you mentioned above (in the specific sense: how much C++03 code
using <limits>, <complex>, etc, which we care about, would break in
C++0x mode only because of the bugs), or if in principle could be fixed
in time for 4.6.0.

Missing further clarifications, I vote against the library-only changes.

Paolo.



More information about the Gcc-patches mailing list