[cfe-dev] InitListExpr::getSyntacticForm and C++

John McCall rjmccall at apple.com
Tue Jan 25 14:39:36 PST 2011

On Jan 25, 2011, at 2:22 PM, Abramo Bagnara wrote:
> Il 25/01/2011 20:51, John McCall ha scritto:
>> On Jan 25, 2011, at 11:49 AM, Abramo Bagnara wrote:
>>> Il 25/01/2011 20:37, John McCall ha scritto:
>>>> On Jan 25, 2011, at 11:18 AM, Abramo Bagnara wrote:
>>>>> I've just verified that in:
>>>>> class C {
>>>>> public:
>>>>> C(int a);
>>>>> };
>>>>> C v[3] = {1,2,3.0};
>>>>> the InitListExpr returned by InitListExpr::getSyntacticForm misses all
>>>>> the fundamental info about implicit casts and CXXConstructExpr.
>>>>> Is this deliberate (why?) or it is a bug to fix?
>>>> Does the syntactic form normally have any of this stuff?  I thought it was just the initializer list as it was written in the source, without further analysis or comment.
>>> As you can see from the typescript above, implicit casts are where they
>>> are expected, but AST is without CXXConstructExpr and implicit cast when
>>> initialized type is a class.
>> I think that's more an accident than anything else.
> I'm not sure to read you right: are you saying that you believe it is an
> accident the lack of CXXConstructExpr/ImplicitCastExpr for class typed
> initializer or the presence of implicit casts for initializer with
> builtin types?

The only reason that the syntactic InitListExpr has implicit casts in it is
that we try to reuse the syntactic ILE as the semantic ILE.  You should
not count on the syntactic ILE ever having such casts.


More information about the cfe-dev mailing list