Fix a crash when a record type initializes itself in its own base class initializer list.
Details
- Reviewers
aaron.ballman hokein alexfh - Commits
- rGb5cac80c7719: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class…
rCTE268369: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class…
rL268369: Fix a crash in cppcoreguidelines-pro-type-member-init when checking a class…
Diff Detail
Event Timeline
test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp | ||
---|---|---|
342 | Is it required to be a templated class to trigger the crash? |
LGTM. Thanks!
test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp | ||
---|---|---|
342 | Yes, it's required. |
LGTM with a commenting request.
test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp | ||
---|---|---|
342 | Then some comments in this test would be good, I would assume otherwise from just looking at the test. |
test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp | ||
---|---|---|
342 | 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. |
test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp | ||
---|---|---|
342 | Added a comment explaining why the check is there. |
test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp | ||
---|---|---|
342 | Thank you, the comment is excellent. |
Is it required to be a templated class to trigger the crash?