AST-dump

That seems like an approach that works. I don’t know that there’s a different common property. Why’s the default constructor different from the copy constructor here?

First of all, sorry but I made a mistake in the example:

class A{

  1. A(){…}
  2. A(int a){…}
  3. A(const A& a){… …}
    };

What I mean is that I need to find if there is at least one constructor that explicitly overloads the default constructor so that if I delete the default constructor the compiler won’t provide the default constructor. So, my question was totally erroneous as the copy constructor does overload the default constructor if provided, but I don’t want to take it into account if it wasn’t explicitly provided.

A better question is: which are the kind of constructors that the compiler provides if no constructors are explicitly supplied? Only the default and the copy constructor (in some situations)?

If “unless(allOf(… …))” is the best solution, could someone enumerate the kind of constructors I must to indicate in that matcher?

I’d suggest to not use ast-dump-xml any more. It’s basically deprecated, and hopefully it’ll be removed soon. -ast-dump gives you all the information (and more).

Ok, I didn’t know it.

… you can see that one is the default constructor and the other one is the copy constructor. If you just put “G g;” into the code instead of the second class, you’ll also see that a simple use of G already triggers the copy constructor to appear. Others are probably better able to explain exactly when a copy constructor is created.

Further information will be well received.

Regards,

Pedro.

El dia 27 may 2013 12:24, Manuel Klimek klimek@google.com escribió:

That seems like an approach that works. I don't know that there's a
different common property. Why's the default constructor different from the
copy constructor here?

First of all, sorry but I made a mistake in the example:

class A{
1. A(){...}
2. A(int a){...}
3. *A(const A& a){... ...}*
};

What I mean is that I need to find if there is at least one constructor
that explicitly overloads the default constructor so that if I delete the
default constructor the compiler won't provide the default constructor. So,
my question was totally erroneous as the copy constructor does overload the
default constructor if provided, but I don't want to take it into account
if it wasn't explicitly provided.

A better question is: which are the kind of constructors that the compiler
provides if no constructors are explicitly supplied? Only the default and
the copy constructor (in some situations)?

Default, copy, and move constructors are provided implicitly (under various
conditions - obviously if you have members that aren't default, copy, or
move constructible, you might not/cannot get all of those)