<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[template member function call in template function fails.]]></title><description><![CDATA[<p>Hi Guys,</p>
<p>the following code fails with gcc 4.7.2 and clang 3.5.0. Do I miss something or should this compile. It works if I call the member function from a normal function. gcc is talking about operator&lt;. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
<pre><code>#include &lt;iostream&gt;

struct test
{
   template &lt;unsigned _nIndex_&gt;
   int doit()
   {
      return _nIndex_;
   }
};

template &lt;typename T&gt;
int doit2(T t)
{
   return t.doit&lt;5&gt;();
}

int main()
{
   struct test t;

   std::cout &lt;&lt; doit2(t) &lt;&lt; std::endl;

   return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/328959/template-member-function-call-in-template-function-fails</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 07:40:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/328959.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Nov 2014 23:53:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to template member function call in template function fails. on Sat, 01 Nov 2014 23:53:21 GMT]]></title><description><![CDATA[<p>Hi Guys,</p>
<p>the following code fails with gcc 4.7.2 and clang 3.5.0. Do I miss something or should this compile. It works if I call the member function from a normal function. gcc is talking about operator&lt;. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
<pre><code>#include &lt;iostream&gt;

struct test
{
   template &lt;unsigned _nIndex_&gt;
   int doit()
   {
      return _nIndex_;
   }
};

template &lt;typename T&gt;
int doit2(T t)
{
   return t.doit&lt;5&gt;();
}

int main()
{
   struct test t;

   std::cout &lt;&lt; doit2(t) &lt;&lt; std::endl;

   return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2425358</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2425358</guid><dc:creator><![CDATA[Martin Kalbfuß]]></dc:creator><pubDate>Sat, 01 Nov 2014 23:53:21 GMT</pubDate></item><item><title><![CDATA[Reply to template member function call in template function fails. on Sun, 02 Nov 2014 00:02:45 GMT]]></title><description><![CDATA[<p>C++ requires the <code>template</code> keyword there for disambiguation.</p>
<pre><code class="language-cpp">template &lt;typename T&gt;
int doit2(T t)
{
   return t.template doit&lt;5&gt;();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2425359</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2425359</guid><dc:creator><![CDATA[TyRoXx]]></dc:creator><pubDate>Sun, 02 Nov 2014 00:02:45 GMT</pubDate></item><item><title><![CDATA[Reply to template member function call in template function fails. on Sun, 02 Nov 2014 12:31:15 GMT]]></title><description><![CDATA[<p>Thank you. I was aware of &quot;typename&quot; but not of &quot;template&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2425413</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2425413</guid><dc:creator><![CDATA[Martin Kalbfuß]]></dc:creator><pubDate>Sun, 02 Nov 2014 12:31:15 GMT</pubDate></item><item><title><![CDATA[Reply to template member function call in template function fails. on Sun, 02 Nov 2014 12:39:45 GMT]]></title><description><![CDATA[<p>Merkwürdig dass er auf Englisch schreibt aber sich einen deutschen Namen gewählt hat (der mit einer englischen Tastatur schwer zu schreiben ist).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2425416</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2425416</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sun, 02 Nov 2014 12:39:45 GMT</pubDate></item><item><title><![CDATA[Reply to template member function call in template function fails. on Sun, 02 Nov 2014 12:43:43 GMT]]></title><description><![CDATA[<p>Mit .net TLD wirds jetzt halt &quot;international&quot; <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2425418</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2425418</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Sun, 02 Nov 2014 12:43:43 GMT</pubDate></item><item><title><![CDATA[Reply to template member function call in template function fails. on Sun, 02 Nov 2014 13:46:13 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<p>Merkwürdig dass er auf Englisch schreibt aber sich einen deutschen Namen gewählt hat (der mit einer englischen Tastatur schwer zu schreiben ist).</p>
</blockquote>
<p>Why not. To be honest I also prefer writing/speaking English.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2425426</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2425426</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Sun, 02 Nov 2014 13:46:13 GMT</pubDate></item><item><title><![CDATA[Reply to template member function call in template function fails. on Sun, 02 Nov 2014 14:36:31 GMT]]></title><description><![CDATA[<p>Ethon schrieb:</p>
<blockquote>
<p>Arcoth schrieb:</p>
<blockquote>
<p>Merkwürdig dass er auf Englisch schreibt aber sich einen deutschen Namen gewählt hat (der mit einer englischen Tastatur schwer zu schreiben ist).</p>
</blockquote>
<p>Why not. To be honest I also prefer writing/speaking English.</p>
</blockquote>
<p>In that case why don't we just change the default language in this forum to English? There's a reason we're talking German. I reckon that if it wasn't for the language (and our tolerance in respect to beginners posts) some people wouldn't come here in the first place and go straight to stackoverflow.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2425432</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2425432</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sun, 02 Nov 2014 14:36:31 GMT</pubDate></item><item><title><![CDATA[Reply to template member function call in template function fails. on Sun, 02 Nov 2014 15:15:53 GMT]]></title><description><![CDATA[<p>Leider ist das Englisch von vielen Deutschen, die meinen es gut zu können, doch eher minderer Qualität...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2425434</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2425434</guid><dc:creator><![CDATA[oenone]]></dc:creator><pubDate>Sun, 02 Nov 2014 15:15:53 GMT</pubDate></item></channel></rss>