clang-tidy's modernize-use-default-member-init was crashing for unions
with an existing default member initializer.
Fixes PR40492
Differential D57665
[clang-tidy] Handle unions with existing default-member-init malcolm.parsons on Feb 3 2019, 1:47 PM. Authored by
Details clang-tidy's modernize-use-default-member-init was crashing for unions Fixes PR40492
Diff Detail
Event TimelineComment Actions Just to make sure I understand the issue correctly (and so please correct me if I am wrong): The union member e leads to an IndirectFieldDecl in the record for UnionExisting. Then CXXCtorInitializer::getMember returns null since the initialized member is not a FieldDecl, but an IndirectFieldDecl. Using CXXCtorInitializer::getAnyMember handles both FieldDecls and IndirectFieldDecls, which solves the issue. Looks OK but probably better to wait for someone else to give the OK ? Comment Actions LGTM, please close the bug report and notify for the fix with the request to check in the real-project if it actually fixes the issue. Thanks :) |