[cfe-commits] r147026 - in /cfe/trunk: lib/AST/Expr.cpp test/Sema/static-init.c

Eli Friedman eli.friedman at gmail.com
Wed Dec 21 20:48:34 PST 2011


On Wed, Dec 21, 2011 at 2:51 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Tue, Dec 20, 2011 at 7:42 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>>> Err, great.  That will be a bit annoying to write.  It would make all
>>> the constant stuff a bit less complicated if Evaluate could handle all scalar
>>> expressions...
>>
>> I agree, and we're very close. The cases we can't evaluate are:
>>
>>  - difference of two address labels (would need a new APValue kind)
>>  - calls to trivial constructors (which are not constexpr)
>>  - vector bitcasts
>>  - cast to union
>
> I think there might be a few other cases you're missing (one or two
> involving compound literals, some cases involving string literals,
> maybe a couple others), but yes, it's close.

Here's a more-or-less complete list of what is missing on trunk to get
through the clang regression tests with isConstantInitializer
forwarding to Evaluate:
- StringLiteral and ObjCEncodeExpr outside of an InitListExpr
- InitListExprs of scalar type (int, float, etc.)
- RecordExprEvaluator::ValueInitialization
- CXXTemporaryObjectExpr
- cast to union
- difference of two address labels

-Eli




More information about the cfe-commits mailing list