[PATCH] D113518: [clang] Create delegating constructors even in templates

Fabian Wolff via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 11 12:09:53 PST 2021


fwolff added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp:374
 {
   PositiveSelfInitialization() : PositiveSelfInitialization() {}
 };
----------------
carlosgalvezp wrote:
> fwolff wrote:
> > carlosgalvezp wrote:
> > > Not really sure what this test is meant to do. Why would it call the destructor of the own class in it's own constructor? Looks very strange to me.
> > > 
> > > If anything, the constructor should call the constructor of the base:
> > > 
> > > PositiveSelfInitialization() : NegativeAggregateType()
> > > 
> > > What do you think?
> > The comment above talks about a "pathological template", so my guess is that this checks that clang-tidy doesn't crash for this input. The only reason why I had to touch this test at all is that the constructor is now treated as a delegating constructor, which suppresses the warning.
> Hmm, I see. I would like to make sure we still catch the failure mode "this constructor does not initialize these base classes" for class templates.
> 
> I don't see such test existing (only for non-template classes), maybe you can add that too?
Good point, done now.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113518/new/

https://reviews.llvm.org/D113518



More information about the cfe-commits mailing list