[libcxx-commits] [PATCH] D127695: WIP: clang: Implement Template Specialization Resugaring
Matheus Izvekov via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 10 08:25:29 PDT 2022
mizvekov added inline comments.
================
Comment at: clang/test/Sema/Resugar/resugar-expr.cpp:244
+// N-error at -2 {{with an rvalue of type 'int'}}
+} // namespace t21
----------------
davrec wrote:
> Compositions of MemberExprs/CXXMemberCallExprs have an issue:
> ```
> template <class A1> struct A {
> struct Inner {
> A1 m;
> A1 f();
> } inner;
> Inner g();
> };
> Z x1 = A<Int>().inner.m; //No resugar
> Z x2 = A<Int>().inner.f(); //No resugar
> Z x3 = A<Int>().g().m; //No resugar
> Z x4 = A<Int>().g().f(); //No resugar
> Z x5 = A<Int>::Inner().m; //ok
> ```
>
> Composed `CallExprs` seem to work but probably warrant a test, e.g.
> ```
> template <class B1> B1 h(B1);
> Z x6 = h(Int());
> Z x7 = h(h(Int()));
> ```
>
> https://godbolt.org/z/cszrsvh8d
>
Thanks for the feedback!
The problem here I think is that for a MemberExpr, we have to look at not only the BaseType of it for a resugaring context, but instead look at its BaseExpr to see if it or any bases of it, and so on recursively, can provide a resugaring context as well, effectively building one naming context from the whole composition.
I will try to address that later, I probably should work on facilitating the reviews of the other patches in this stack, and then splitting this one big patch up more :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127695/new/
https://reviews.llvm.org/D127695
More information about the libcxx-commits
mailing list