[PATCH] D98160: [clang] Use decltype((E)) for compound requirement type constraint

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 24 16:05:32 PDT 2021


mizvekov marked 2 inline comments as done.
mizvekov added inline comments.


================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:8643
     QualType MatchedType =
-        BuildDecltypeType(E, E->getBeginLoc()).getCanonicalType();
+        BuildDecltypeType(E, E->getBeginLoc(), true, true).getCanonicalType();
     llvm::SmallVector<TemplateArgument, 1> Args;
----------------
mizvekov wrote:
> rsmith wrote:
> > Instead of adding complexity to the type system to deal with this special case, can you directly create a `ParenExpr` here?
> Hmm I thought about that. Since I am a bit unfamiliar with the code there, I was not sure it was going to end up being more or less complicated than the proposed solution. But I'll give it a shot if that looks simpler to you.
So yeah, now we just get the type of the expression directly, by using the now exposed underlying code from decltype.
This is OK since the expressions in the requires clause were never dependent in the first place.
Even though just creating the parensexpr would likely lead to a smaller change as in number of lines of code modified, I think not using it makes the fact that dependency is not an issue here more clear in the code than just reusing the full decltype machinery.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98160



More information about the cfe-commits mailing list