Page MenuHomePhabricator

If a function decl cannot be merged, mark it as invalid, phab edition.

Authored by thakis on Jan 16 2015, 1:57 PM.



Clang currently crashes on

class C {
  C() = default;
  C() = delete;

My cunning plan for fixing this was to change the if (!FnD) in Parser::ParseCXXInlineMethodDef() to if (!FnD || FnD->isInvalidDecl) – but alas, the second constructor decl wasn't marked as invalid. This patch lets Sema::MergeFunctionDecl() return true on function redeclarations, which leads to them being marked invalid. (There are two more diag::err_s later in the same function that also don't return true. These look fishy to me too – let me know if you think those should be changed too. Probably in a separate patch, though.)

This reduces the number of duplicate error messages in tests, which is probably a good thing for this kind of error – if you have two definitions of a function, things likely are pretty dire already.

Diff Detail

Event Timeline

thakis updated this revision to Diff 18313.Jan 16 2015, 1:57 PM
thakis updated this revision to Diff 18319.
thakis retitled this revision from to If a function decl cannot be merged, mark it as invalid, phab edition..
thakis updated this object.
thakis edited the test plan for this revision. (Show Details)
thakis added a reviewer: rsmith.
thakis added a subscriber: Unknown Object (MLST).
rsmith accepted this revision.Jan 16 2015, 5:52 PM
rsmith edited edge metadata.

LGTM, all of these diagnostic changes look great.

This revision is now accepted and ready to land.Jan 16 2015, 5:52 PM