[cfe-commits] r162835 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/Sema/init.c
Hans Wennborg
hans at chromium.org
Wed Aug 29 11:30:13 PDT 2012
On Wed, Aug 29, 2012 at 7:04 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Wed, Aug 29, 2012 at 3:38 AM, Hans Wennborg <hans at chromium.org> wrote:
>> On Wed, Aug 29, 2012 at 10:40 AM, Richard Smith <richard at metafoo.co.uk>
>> > I've looked into what's specified for C++11 constant expression
>> > semantics,
>> > and it looks like this isn't the correct behavior there. C++11
>> > thread_local
>> > variables *can* be used in core constant expressions, but can't be part
>> > of
>> > the eventual result of constant expression evaluation. It looks like the
>> > check belongs in CheckLValueConstantExpression instead.
>> >
>> > For instance, this is valid under the C++11 rules:
>> >
>> > thread_local int n;
>> > constexpr bool b = &n == &n;
>>
>> I guess I'm out of my depth here, because I don't really know how
>> these things work.
>
>
> When it comes to the interactions of constexpr and thread_local, I think
> almost no-one does.
>
>>
>> Does the attached patch look like it's doing the
>> right thing?
>
>
> LGTM
Thanks! Landed r162850.
- Hans
More information about the cfe-commits
mailing list