[cfe-commits] r162835 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/Sema/init.c

Hans Wennborg hans at chromium.org
Wed Aug 29 02:20:20 PDT 2012


On Wed, Aug 29, 2012 at 10:05 AM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Wed, Aug 29, 2012 at 1:44 AM, Hans Wennborg <hans at hanshq.net> wrote:
>>  bool LValueExprEvaluator::VisitVarDecl(const Expr *E, const VarDecl *VD)
>> {
>> +  if (VD->isThreadSpecified())
>> +    return false;
>
> That should be 'return Error(E);' (constant expression evaluation shouldn't
> fail without producing a diagnostic). As a testcase, we should reject this:
>
> __thread int n;
> constexpr int &f() { return n; }

Thanks, Richard! Fixed in r162837.

 - Hans



More information about the cfe-commits mailing list