GorNishanov added inline comments.
================ Comment at: lib/Sema/SemaCoroutine.cpp:1062 + // an argument list." + for (auto *PD : FD.parameters()) { + if (PD->getType()->isDependentType()) ---------------- GorNishanov wrote: > This does not implement TS specified behavior for non static member functions: > > [dcl.fct.def.coroutine]/7 states that an argument list is build up as > follows: > > > The first argument is the amount of space requested, and has type > > std::size_t. The lvalues p1 ... pn are the succeeding arguments. > > Where p1 ... pn are defined earlier in > > [dcl.fct.def.coroutine]/3 as: > > > For a coroutine f that is a non-static member function, let P1 denote the > > type of the implicit object parameter (13.3.1) and P2 ... Pn be the types > > of the function parameters; otherwise let P1 ... Pn be the types of the > > function parameters. > > Essentially for non-static member functions, we need to insert implicit > object parameter. > > Note that lookupPromiseType in SemaCoroutine.cpp when building specialization > of `std::experimental::coroutine_traits<...>` includes implicit object > parameter: > > ``` > // If the function is a non-static member function, add the type > // of the implicit object parameter before the formal parameters. > if (auto *MD = dyn_cast<CXXMethodDecl>(FD)) { > if (MD->isInstance()) { > // [over.match.funcs]4 > // For non-static member functions, the type of the implicit object > // parameter is > // -- "lvalue reference to cv X" for functions declared without a > // ref-qualifier or with the & ref-qualifier > // -- "rvalue reference to cv X" for functions declared with the && > // ref-qualifier > QualType T = > MD->getThisType(S.Context)->getAs<PointerType>()->getPointeeType(); > T = FnType->getRefQualifier() == RQ_RValue > ? S.Context.getRValueReferenceType(T) > : S.Context.getLValueReferenceType(T, /*SpelledAsLValue*/ true); > AddArg(T); > } > } > ``` I think promise constructor argument preview is also missing the implicit object parameter. Repository: rC Clang https://reviews.llvm.org/D42606 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits