[PATCH] D19802: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class that initializes itself as a base

Michael Miller via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 15:31:43 PDT 2016


michael_miller added inline comments.

================
Comment at: test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp:342
@@ +341,3 @@
+
+template <typename T>
+class PositiveSelfInitialization : NegativeAggregateType
----------------
aaron.ballman wrote:
> hokein wrote:
> > aaron.ballman wrote:
> > > Is it required to be a templated class to trigger the crash?
> > Yes, it's required.
> Then some comments in this test would be good, I would assume otherwise from just looking at the test.
It's a little bit of a pathological example. Without the template, the code won't compile at all due to an error. The check doesn't crash in that case (error: constructor for 'PositiveSelfInitialization' creates a delegation cycle [clang-diagnostic-delegating-ctor-cycles]). With the template in the mix, apparently PositiveSelfInitialization doesn't have a valid RecordDecl. If you instantiate the template, though, the code again fails to compile.


http://reviews.llvm.org/D19802





More information about the cfe-commits mailing list