[cfe-dev] [libc++] RFC: adding a configuration option to enable constexpr constructors in c++1[xy]
Eric Fiselier via cfe-dev
cfe-dev at lists.llvm.org
Wed Nov 8 01:23:32 PST 2017
> The initialization might happen at compile time, even in C++11 or C++98.
> See http://eel.is/c++draft/basic.start.static#3
*might happen*. Even worse...
I think we're jumping the gun. First, we're the only standard library to
not backport these extensions.
In this sense of strict conformance, we're the odd man out: We're the only
one to exhibit the bad behavior.
Before we concern ourselves too much with standards conformance, we need to
establish that making
the suggested changes would actually break reasonable user code. (Which I
haven't been able to do in a meaningful way).
Can somebody provide an example of such code?
Otherwise, we should do as the Romans do, and change libc++ to do the
*right* thing.
/Eric
On Thu, Oct 12, 2017 at 10:18 AM, Jeff Hammond <jeff.science at gmail.com>
wrote:
>
> On Thu, Oct 12, 2017 at 7:39 AM Brian Cain via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> > -----Original Message-----
>> > From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of
>> Howard
>> > Hinnant via cfe-dev
>> ...
>> > Random, untested thought:
>> >
>> > What if in <__config> every _LIBCPP_CONFIG_MACRO was defined like this:
>> >
>> > #ifndef _LIBCPP_CONFIG_MACRO
>> >
>> > // Current configuration goes here
>> >
>> > #endif
>> >
>> > And then clients could compile like this if desired:
>> >
>> > clang++ -D_LIBCPP_CONSTEXPR_AFTER_CXX11=constexpr …
>> >
>> > libc++ stays conformant, but becomes far more configurable.
>>
>> That seems a little awkward. What if we added a "-std=clang++11" mode
>> (like "gnu++11" ) that would specify that definition when stdlib=libc++?
>> If we came up with other good-for-users deviations from the standard, we
>> could enable them in this mode.
>
>
> +1
>
> Please do not deliberately break standard conformance when apparently
> standard-enforcing flags are used.
>
> Jeff
> --
> Jeff Hammond
> jeff.science at gmail.com
> http://jeffhammond.github.io/
>
On Thu, Oct 12, 2017 at 10:18 AM, Jeff Hammond <jeff.science at gmail.com>
wrote:
>
> On Thu, Oct 12, 2017 at 7:39 AM Brian Cain via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> > -----Original Message-----
>> > From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of
>> Howard
>> > Hinnant via cfe-dev
>> ...
>> > Random, untested thought:
>> >
>> > What if in <__config> every _LIBCPP_CONFIG_MACRO was defined like this:
>> >
>> > #ifndef _LIBCPP_CONFIG_MACRO
>> >
>> > // Current configuration goes here
>> >
>> > #endif
>> >
>> > And then clients could compile like this if desired:
>> >
>> > clang++ -D_LIBCPP_CONSTEXPR_AFTER_CXX11=constexpr …
>> >
>> > libc++ stays conformant, but becomes far more configurable.
>>
>> That seems a little awkward. What if we added a "-std=clang++11" mode
>> (like "gnu++11" ) that would specify that definition when stdlib=libc++?
>> If we came up with other good-for-users deviations from the standard, we
>> could enable them in this mode.
>
>
> +1
>
> Please do not deliberately break standard conformance when apparently
> standard-enforcing flags are used.
>
> Jeff
> --
> Jeff Hammond
> jeff.science at gmail.com
> http://jeffhammond.github.io/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171108/bf99ee8e/attachment.html>
More information about the cfe-dev
mailing list