Page MenuHomePhabricator

[analyzer] pr32088: Don't destroy the temporary if its initializer causes return.

Authored by NoQ on Mar 1 2017, 7:25 AM.



In the following code involving GNU statement-expression extension:

struct S {

void foo() {
  const S &x = ({ return; S(); });

function foo() returns before reference x is initialized. We shouldn't call the destructor for the temporary object lifetime-exteneded by x in this case, because the object never gets constructed in the first place.

The real problem is probably in the CFG somewhere, so this is a quick-and-dirty hotfix rather than the perfect solution.

Diff Detail


Event Timeline

NoQ created this revision.Mar 1 2017, 7:25 AM
dcoughlin accepted this revision.Mar 1 2017, 8:37 AM

Seems like a safe quick fix for the crash. Looks good to me!

This revision is now accepted and ready to land.Mar 1 2017, 8:37 AM
This revision was automatically updated to reflect the committed changes.