Page MenuHomePhabricator

[AST][RecoveryExpr] Preserve type for broken member call expr.
AcceptedPublic

Authored by hokein on May 18 2020, 1:09 AM.

Details

Reviewers
sammccall

Diff Detail

Event Timeline

hokein created this revision.May 18 2020, 1:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2020, 1:09 AM
hokein marked an inline comment as done.May 18 2020, 1:54 AM
hokein added inline comments.
clang/lib/Sema/SemaOverload.cpp
14105

It is a bit sad that the broken function call cases (too many/few agguments) are failing into this group, all candidates are not viable -- this means we don't get any benefits (no Best), for some cases, it is suboptimal even though the best candidate looks like obvious.

class Collection {
  const char *find(int) const;
  char* find(int);
};
void test1(const Collection &C) {
 C.find(); // we want const char*, but all overloads are not viable and return types are not the same, so no type captured here.
}
sammccall accepted this revision.May 18 2020, 10:03 AM
sammccall added inline comments.
clang/lib/Sema/SemaOverload.cpp
14083

seems like bool Success = false would be a "safer" default and have to be set in fewer places

14105

Yeah, at some point we can add more heuristics (discard non-viable or hidden functions using heuristics) to handle this case, like I did in SemaCodeComplete...

14133

resolvation -> resolution

clang/test/AST/ast-dump-recovery.cpp
123

why does this not work?
isn't there only one candidate, so chooseRecoveryType should pick it?

This revision is now accepted and ready to land.May 18 2020, 10:03 AM

@hokein Did this get landed at some point?