<div dir="ltr"><div dir="ltr"><div style="font-family:courier new,monospace;font-size:large" class="gmail_default">Hi all,<br><br>If I run `clang++ -std=c++17 -Xclang -ast-dump` on the following code:<br><br>struct B {};<br><br>struct D1 : B {};<br><br>struct D2 : public B {};<br><br>the output is<br><br>|-CXXRecordDecl 0x8000bdd48 <kg.cpp:1:1, col:11> col:8 referenced struct B definition<br>| |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init<br>| | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr<br>| | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param<br>| | |-MoveConstructor exists simple trivial needs_implicit<br>| | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param<br>| | |-MoveAssignment exists simple trivial needs_implicit<br>| | `-Destructor simple irrelevant trivial needs_implicit<br>| `-CXXRecordDecl 0x8000bde58 <col:1, col:8> col:8 implicit struct B<br>|-CXXRecordDecl 0x8000bdef8 <line:3:1, col:16> col:8 struct D1 definition<br>| |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable trivial literal has_constexpr_non_copy_move_ctor can_const_default_init<br>| | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr<br>| | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param<br>| | |-MoveConstructor exists simple trivial needs_implicit<br>| | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param<br>| | |-MoveAssignment exists simple trivial needs_implicit<br>| | `-Destructor simple irrelevant trivial needs_implicit<br>| |-public 'B'<br>| `-CXXRecordDecl 0x80015c878 <col:1, col:8> col:8 implicit struct D1<br>`-CXXRecordDecl 0x80015c918 <line:5:1, col:23> col:8 struct D2 definition<br>  |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable trivial literal has_constexpr_non_copy_move_ctor can_const_default_init<br>  | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr<br>  | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param<br>  | |-MoveConstructor exists simple trivial needs_implicit<br>  | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param<br>  | |-MoveAssignment exists simple trivial needs_implicit<br>  | `-Destructor simple irrelevant trivial needs_implicit<br>  |-public 'B'<br>  `-CXXRecordDecl 0x80015ca68 <col:1, col:8> col:8 implicit struct D2<br></div><div dir="ltr"><div style="font-family:courier new,monospace;font-size:large" class="gmail_default">I can see no difference between the CXXRecordDecl for D1 and D2. Is there a way to tell, when visiting the AST, whether the inheritance of the derived class was specified implicitly or explicitly? (Hopefully yes, just not visible in the output of ast-dump).<br></div><br></div><div dir="ltr"><br>Csaba<br>Sent from my 12-core Windows machine, using Gmail.<br></div><div dir="ltr">-- <br><div dir="ltr" class="gmail_signature">You can get very substantial performance improvements<br>by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler<br>So if you're looking for a completely portable, 100% standards-conformant way<br>to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)</div></div></div></div>