[cfe-commits] r140459 - in /cfe/trunk: lib/AST/ExprConstant.cpp lib/CodeGen/CGExprScalar.cpp lib/Sema/SemaInit.cpp test/CodeGenCXX/cxx0x-initializer-scalars.cpp
Douglas Gregor
dgregor at apple.com
Mon Sep 26 12:08:28 PDT 2011
On Sep 26, 2011, at 10:49 AM, Sebastian Redl wrote:
>
> On 26.09.2011, at 17:07, Douglas Gregor wrote:
>
>>
>> On Sep 24, 2011, at 10:48 AM, Sebastian Redl wrote:
>>
>>>
>>> +bool IntExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
>>> + if (!Info.Ctx.getLangOptions().CPlusPlus0x)
>>> + return Error(E);
>>> +
>>> + if (E->getNumInits() == 0)
>>> + return Success(0, E);
>>> +
>>> + assert(E->getNumInits() == 1 && "Excess initializers for integer in C++11.");
>>> + return Visit(E->getInit(0));
>>> +}
>>
>> I'm flip-flopping a little on whether I would prefer:
>>
>> if (!Info.Ctx.getLangOptions().CPlusPlus0x || E->getNumInits() > 1)
>>
>> so we don't have the assertion. It seems overly picky to assert on this kind of thing, when it is allowed in some dialects. Perhaps I'm just being paranoid.
>
> Init list checking doesn't allow excess initializers for scalars in any C++ dialect. I would rather like to catch any change in this behavior, instead of silently
> ignoring all but the first initializer.
Yeah, okay. That makes sense.
- Doug
More information about the cfe-commits
mailing list