[PATCH] D133066: fix a typo in comment of AddConversionCandidate

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 08:20:30 PDT 2022


aaron.ballman added a comment.

In D133066#3845136 <https://reviews.llvm.org/D133066#3845136>, @zhouyizhou wrote:

> After 4 weeks' study, I think the comment didn't need to be changed, sorry to have bring your so much trouble.

No worries at all, there was no trouble here!

> During this valuable process of studying, I grow up a lot. I learned to read the C++ standard, and compare the standard to its implementation.
> In my case, the "user-defined conversion" is the variable "Candidate", the "second standard conversion sequence" is the object member  "Candidate.FinalConversion".
> The only pity during my study is that I can't find a example code to let Clang (even with commit cba72b1f620fd) hit the code below above comment.

I'm glad you found it valuable! As for a code example to hit the code below that comment, the closest I could come is:

  struct S {
    operator int&& () const { return 12; }
  };
  
  void func(int &&i);
  
  int main() {
    S s;
    func(s);
  }

however, that still fails the lvalue-to-rvalue test. I poked at it for a while and I'm not seeing a case where it's possible to hit that condition (it doesn't mean one doesn't exist, just that I didn't have the time to chase it down fully).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133066/new/

https://reviews.llvm.org/D133066



More information about the cfe-commits mailing list