Page MenuHomePhabricator

[CFG] [analyzer] Fix a crash on finding construction context for implicit constructor conversion.

Authored by NoQ on Feb 27 2018, 4:21 PM.



While landing D43428 as rC325966, i caused an internal compiler error of an MSVC 2015 compiler on a buildbot. Then i tried to hotfix it in rC325969 (which didn't help) and in rC325978 (which suddenly helped, i.e. simply moving the existing code around has suppressed the crash). Then i committed D43481 as rC326016 and MSVC crashed again. Then i committed rC326021 as a hotfix, and it seemed to help again.

The problem is, i lost some code in rC326021. Namely i forgot to check that the cast that's mentioned in D43481 / rC326016 is a NoOp-kind cast.

Bring back the check for the cast kind, add a test for it.

The test exposes an interesting edge case that we don't support yet: implicit constructor conversion. For now we only support explicit constructor conversion (i.e. functional cast as in D43480). For whatever reason, in this case the AST doesn't contain a CXXBindTemporaryExpr even if the object requires destruction, so the assertion in ConstructionContext::createFromLayers that says that any construction context with an MTE but without the respective BTE should be of an object with a trivial destructor (which isn't a problem here because the object is lifetime-extended anyway).

Diff Detail


Event Timeline

NoQ created this revision.Feb 27 2018, 4:21 PM

Should there be a FIXME note saying that other casts should be supported?

This revision is now accepted and ready to land.Feb 28 2018, 11:21 AM
NoQ updated this revision to Diff 136434.Feb 28 2018, 4:52 PM

Add the comment.

This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.