<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jul 9, 2018 at 2:21 AM, Saar Raz via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hey,<div>I'm working on our concepts implementation and am pretty close to finishing the implementation. All that's left is requires-expressions which I have the code mostly written for, and am testing it now.</div><div>I came across a dilemma with requires-expressions and would like to know what you guys think should happen.</div><div>We have requires expressions which declare local parameters - parameters that need to be visible in the body of the requires-expression. The current machinery would require such decls to reside in a declcontext which itself should be a decl as it stands today.</div></div></blockquote><div>Agreed that we need <span style="font-family:monospace,monospace">Decl</span>s for the parameters, and the requires-expression is a reasonable place for the DeclContext. I am not sure if making the expression itself also a Decl helps or harms, but trying it probably does not hurt.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Should requires-expr therefore be an expression linked to a generated decl? The closest existing thing to this would be a lambda expression, but lambda expressions cannot appear in unevaluated contexts while requires-expressions clearly can.</div></div></blockquote><div>We <i>do</i> allow lambda expressions in unevaluated operands now (see P0315); however, the rules are set up so that we can avoid mangling their content or comparing them within a translation unit.<br>For the purposes of <i>requires-expression</i>s, we will need to both be able to mangle their content and compare them within a translation unit (for redeclaration matching).<br>The comparison will need to adjust for the difference between the <span style="font-family:monospace,monospace">Decl</span>s in one instance and the <span style="font-family:monospace,monospace">Decl</span>s in another. The Standard should probably be adjusted so that the names of the local parameters are ignored for the purpose of determining whether expressions involving template parameters are equivalent.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Also, requires expressions as I have them now can contain another kind of declaration - when using a constrained-parameter requirement (e.g. requires {{ 0 } -> Same<int>;} ), a template parameter list with one parameter is generated.</div></div></blockquote><div>I believe for the similar case of "auto" variables, we produce the template parameter list on the stack.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>My initial thought seems to indicate a "RequiresExprBodyDecl : Decl, DeclContext" is requires here, but I may be missing some implications of this right now - are there any inherent problems with having this sort of declaration generated here?</div><div><br></div><div>Thanks :)</div>
</div>
<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>