-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by aggregate initialization using a default member initializer" #108039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,10 +120,11 @@ void aggregateWithReferences() { | |
clang_analyzer_dump(viaReference); // expected-warning-re {{&lifetime_extended_object{RefAggregate, viaReference, S{{[0-9]+}}} }} | ||
clang_analyzer_dump(viaReference.rx); // expected-warning-re {{&lifetime_extended_object{int, viaReference, S{{[0-9]+}}} }} | ||
clang_analyzer_dump(viaReference.ry); // expected-warning-re {{&lifetime_extended_object{Composite, viaReference, S{{[0-9]+}}} }} | ||
|
||
// clang does not currently implement extending lifetime of object bound to reference members of aggregates, | ||
// that are created from default member initializer (see `warn_unsupported_lifetime_extension` from `-Wdangling`) | ||
RefAggregate defaultInitExtended{i}; // clang-bug does not extend `Composite` | ||
|
||
// FIXME: clang currently support extending lifetime of object bound to reference members of aggregates, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please create an issue for this if it doesn't exist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This because we need to add support in Static Analyzer. I once had a separate PR(#91879) to implement this feature for StaticAnalyzer, but because the CWG1815 implementation was reverted, that PR was also reverted. I'll create an issue for this. |
||
// that are created from default member initializer. But CFG and ExprEngine need to be updated to address this change. | ||
// The following expect warning: {{&lifetime_extended_object{Composite, defaultInitExtended, S{{[0-9]+}}} }} | ||
RefAggregate defaultInitExtended{i}; | ||
clang_analyzer_dump(defaultInitExtended.ry); // expected-warning {{Unknown }} | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.