Is there any way to view the default functions ( e.g., default copy constructor, default assignment operator ) generated by a compiler such as VC++2008 for a class which does not define them?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With the
clangcompiler, you can see them by passing the-ast-dumpargument. Clang is still in development stage, but you can already use it for these things:I hope that’s what you asked for. Let’s change the code and look again.
Notice how the implicitly declared copy constructor of
Anow has a non-const reference parameter, because one of its members has too (memberm), and thatMhas no default constructor declared.For getting the generated code, you can let it emit virtual machine intermediate language. Let’s look on the generated code for this:
Now, i don’t understand that intermediate language (which is defined at llvm.org). But you can translate all that code into C using the llvm compiler:
Tada! Notice how it sets the virtual table pointer in the copy constructor and default constructor. Hope this helps.