<br><br><div class="gmail_quote">On Mon, Jan 31, 2011 at 5:50 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 Jan 31, 2011, at 1:43 PM, Larisse Voufo wrote:</div><br><blockquote type="cite">Thanks. That was a lot helpful. However, I do have another question. Consider the following two case scenari: <br>
<br>Case 1:<br>------------<br>The previous one, with<br>(1) f() defined as a concept member, and<br>(2) func() a restricted template<br>
<br><br>Case 2:<br>------------<br>(1) f() is a global function, and<br>(2) func() is a simple template, as in<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">void f() { }<br>
<br>template<typename T></span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">void func(T a) {</span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> f(0);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">int main(int argc, char **argv) </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">{ </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> int i=0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> func<int>(i); </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">}</span><br><br><br>Observation:<br>----------------------<br>In both cases, f() never seems to be "marked for instantiation", at least not through Sema::<div>MarkDeclarationReferenced. However, f() does seem to eventually get instantiated in the "Case 2" somehow, whereas it never does in "Case 1". Any idea?<br>
<br>1) When does f() get instantiated in "Case 2"?<br></div></blockquote><div><br></div></div><div>Case 2 is ill-formed, but the general rule is that MarkDeclarationReferenced will get called when we use that function in a potentially evaluated context, either in non-template code or during template instantiation.</div>
<div class="im"><br></div></div></div></blockquote><div>Sorry about this. I meant for the definition of f() to take an integer in as argument... <br></div><div> </div><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;"><div><div class="im"><blockquote type="cite"><div>2) is this connected to lookup somehow?<br> I have made some very minor changes in Sema::CppLookupName(), and I'm not sure how this could affect instantiation...<br>
</div></blockquote></div></div><div><br></div><div>It's more likely that you haven't added any logic to permit the instantiation of functions defined within concept maps.</div></div></blockquote><div><br>Any rule of thumb on how to add such logic? Say, for example how is this currently setup for "(corrected) Case 2"?<br>
<br> </div><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><span style="white-space: pre-wrap;"> </span>- Doug</div>
</div></blockquote></div><br>