<br><br><div class="gmail_quote">On Tue, Feb 1, 2011 at 3:01 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="word-wrap: break-word;"><br><div><div class="im"><div>On Feb 1, 2011, at 11:45 AM, Larisse Voufo wrote:</div><br><blockquote type="cite">Let me see if I can rephrase this problem... <br>At this point, instantiation is no longer an issue. The issue is managing new DeclContext's.<br>
<br>Take the following definition of a concept:<br><br>concept A<typename T> {<br>
    void f(int) { }<br>}<br><br>This definition is parsed into a ConceptDecl  object <b>ContextA</b> where ConceptDecl is a DeclContext as well as a TemplateDecl.<br>When the concept is used on a generic function such as:<br>

<br>template<typename T><br>requires A<T><br>void func(T a) {<br>    f(a);<br>}<br><br>at the call f(a),  the lookup process finds the definition of f() in the DeclContext <b>ContextA</b>.  <br>Hence, the definition of func() is accepted. <br>

Let's refer to the found definition as <b>Fn</b>.<br><br>Now, when func() is used in the main, the lookup and instantiation-related processes are still finding and using that same definition of f(): Fn.<br></blockquote>
<div><br></div></div><div>That's wrong. You need to map from the concept's function f() to the corresponding function f() in the concept map.</div><div><br></div><div><span style="white-space: pre-wrap;">        </span>- Doug</div>
</div></div></blockquote><div><br>Perhaps I should've phrased that this is the sample case I'm examining at the moment, not the defacto way that concepts should work. The idea above should generalize to any DeclContext, whether they are  ConceptDecls or not. <br>
For instance, forget concepts, call  "concept A<typename T>" My_DeclContext and replace everything as follows:<br><br> My_DeclContext A {<br>
    void f(int) { }<br>}<br>//This definition is parsed into a SomeDecl  object <b>ContextA</b> where SomeDecl is a DeclContext.<br><br>template<...><br><b>lookup_in (A</b>)<br>
void func(T a) {<br>    f(a);<br>}<br><br>Again, the observations from the previous example should naturally translate to this case, and they are the result of an intensive debugging session (overnight)...<br><br><b>If Fn is found and used throughout the compilation, how come it gets lost at link time? </b><br>
My interest is that: if we can get this to work, then I'll know for sure that I understand the way that lookup and instantiation work in clang, with respect to added declaration contexts. <br><br>I'm concerned that we are perhaps getting confused from thinking about this problem from completely different perspective. Marcin was also quite ahead of me on this. :) <br>
Please, just note that I am not particularly thinking of concepts at the moment... I want to very basically understand why the case above would cause the error I am getting, when the only major change I made was in deviating the lookup process for f() so that it is looked up in <b>ContextA </b>-- using LookupQualifiedName(...), rather than in the global scope<b>...<br>
</b></div></div><br>I hope this is clearer...<br><br>I may actually be onto something at the moment, but I'm not sure if it is going to work. So, any idea would help if it isn't too much asking. In any event, I'll continue trying to figure this out... <br>
<br>Thanks,<br><br>-- Larisse.<br><br>