[PATCH] D111639: [Sema] check PseudoObject when rebuilding CXXOperatorCallExpr in template instantiation

Bruno De Fraine via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 7 13:42:45 PST 2021


brunodf reopened this revision.
brunodf added a comment.
This revision is now accepted and ready to land.

When the previous diff was committed, two problems were discovered in the buildbots:

1. One pattern in the `PR51855.cpp` test failed on certain targets due to a difference in calling convention: https://lab.llvm.org/buildbot/#/builders/171/builds/6632
2. In multistage buildbots, an overload resolution failure was reported while compiling the LLVM codebase in stage 2: https://lab.llvm.org/buildbot/#/builders/187/builds/3136

The pattern in the `PR51855.cpp` test is straightforward to generalize.

The stage 2 issue revealed a problem that is now reduced in the `D111639.cpp` test. Here, a unary address-of `&` operator is used on a `DependentScopeDeclRef` (which has dependent type), and the presence of a binary `operator&` overload triggers the use of a `CXXOperatorCallExpr`. When the `CXXOperatorCallExpr` is rebuilt for template instantiation, the argument is an overload set. It has a placeholder type (`BuiltinType::Overload`), but does not respond well to `CheckPlaceHolderExpr` invocation: this triggers the "reference to overloaded function could not be resolved" error.

In `Sema::BuildUnaryOp` there is an extra test clause for `UO_AddrOf` operators in the logic for placeholder types, before calling `CheckPlaceHolderExpr`. I've adopted the same clause here.

Before this diff, there was no initial check for placeholder types (only for `OK_ObjCProperty`) and this would be handled by lines 14661-14669 of `TreeTransform.h` (left-hand side numbering), also resulting in a call to `CreateBuiltinUnaryOp`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111639



More information about the cfe-commits mailing list