<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 31, 2011, at 1:43 PM, Larisse Voufo wrote:</div><br class="Apple-interchange-newline"><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>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><br><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><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><br><div><span class="Apple-tab-span" style="white-space:pre">  </span>- Doug</div></body></html>