GabrielDosReis/ipr

How to represent delegated ctor initializers?

Closed this issue · 2 comments

E.g.

struct Foo
{
    Foo(int);
    Foo(double) : Foo(5) {}
};

Constructor definitions have their "initializers" are given by Ctor_body where the ctor-initializer is given by the inits() and the body of the constructor is given by block(). There is no separate node for a delegating constructor because that is a property of the implementation, not of the declaration of the constructor: if the ctor-initializer contains a call to a constructor from the same class, then you have a delegating constructor. Here the ctor-initializer is represented exactly the same way that you would represent initialization of a base-class subobject.

What are the issues you were running into?

Looks good to me, and in fact the implementation I am working on is doing just that (using he same representation as base-class subobjects). I wanted to double check, if that is OK.