<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>VC2005 Breaking Change: typename’ needed for dependent name to be treated as a type</title><link>http://blogs.msdn.com/aymans/archive/2006/05/05/591022.aspx</link><description>Original Code: template&amp;lt;class T&amp;gt; const T::X&amp;amp; f(T::Z* p); template&amp;lt;class T, int N&amp;gt; struct Baz{}; template&amp;lt;class T&amp;gt; struct Blah : public Baz&amp;lt; T::Type, T::Value&amp;gt; { typedef T::X Type; Type foo(); T::X bar(); operator T::Z(); };</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: VC2005 Breaking Change: typename’ needed for dependent name to be treated as a type</title><link>http://blogs.msdn.com/aymans/archive/2006/05/05/591022.aspx#3135834</link><pubDate>Thu, 07 Jun 2007 11:05:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3135834</guid><dc:creator>ikk</dc:creator><description>&lt;p&gt;It's nice to see the conformance improvements made to VC++. Congratulations!&lt;/p&gt;
</description></item><item><title>re: VC2005 Breaking Change: typename’ needed for dependent name to be treated as a type</title><link>http://blogs.msdn.com/aymans/archive/2006/05/05/591022.aspx#3505321</link><pubDate>Mon, 25 Jun 2007 00:45:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3505321</guid><dc:creator>Michael Gourlay</dc:creator><description>&lt;p&gt;template &amp;lt;class ItemT&amp;gt; class Container&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;class Iterator&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} ;&lt;/p&gt;
&lt;p&gt;} ;&lt;/p&gt;
&lt;p&gt;template &amp;lt;class ItemT&amp;gt; class ContainerAdapter : private Container&amp;lt;ItemT&amp;gt;&lt;/p&gt;
&lt;p&gt;{ &amp;nbsp; // MSVC compiles this, no problem. &amp;nbsp;GCC does not.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Container&amp;lt;ItemT&amp;gt;::Iterator mIter ;&lt;/p&gt;
&lt;p&gt;} ;&lt;/p&gt;
&lt;p&gt;// How do you get this to compile in Microsoft Visual Studio or GCC?&lt;/p&gt;
&lt;p&gt;// BTW, GCC does not like &amp;quot;typename&amp;quot;.&lt;/p&gt;
&lt;p&gt;template &amp;lt;class ItemT&amp;gt; class ContainerContainer&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Container&amp;lt;typename ItemT&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mContainer;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Container&amp;lt;typename ItemT&amp;gt;::Iterator mIter ;&lt;/p&gt;
&lt;p&gt;} ;&lt;/p&gt;
</description></item><item><title>re: VC2005 Breaking Change: typename’ needed for dependent name to be treated as a type</title><link>http://blogs.msdn.com/aymans/archive/2006/05/05/591022.aspx#3513233</link><pubDate>Mon, 25 Jun 2007 08:51:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3513233</guid><dc:creator>mijagourlay</dc:creator><description>&lt;p&gt;I figured it out.&lt;/p&gt;
&lt;p&gt;Putting &amp;quot;typename&amp;quot; before &amp;quot;Container&amp;quot; in the last line allows it to compile. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The &amp;quot;typename&amp;quot; inside the angle brackets is not necessary.&lt;/p&gt;
&lt;p&gt;This works in GCC also.&lt;/p&gt;
</description></item><item><title>vs 2005 error LNK2019: unresolved external symbol</title><link>http://blogs.msdn.com/aymans/archive/2006/05/05/591022.aspx#9437080</link><pubDate>Sat, 21 Feb 2009 11:14:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9437080</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;I'm getting a linker error LNK2019 on vs2005 that I dont understand. Any advice to figured it out are appreicated. &lt;/p&gt;
&lt;p&gt;Original Code:&lt;/p&gt;
&lt;p&gt;#include &amp;quot;stdafx.h&amp;quot;&lt;/p&gt;
&lt;p&gt;template&amp;lt;class T,int BIT&amp;gt; &lt;/p&gt;
&lt;p&gt;class Test &lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	public:&lt;/p&gt;
&lt;p&gt;	typedef struct&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		T a;&lt;/p&gt;
&lt;p&gt;	} _BUF;&lt;/p&gt;
&lt;p&gt;	template&amp;lt;typename T&amp;gt;friend Test&amp;lt;T,BIT&amp;gt;operator+(Test&amp;lt;T,BIT&amp;gt;&amp;amp;, Test&amp;lt;T,BIT&amp;gt;&amp;amp;);&lt;/p&gt;
&lt;p&gt;	friend					 &amp;nbsp; Test&amp;lt;T,BIT&amp;gt;BufRestore(_BUF&amp;amp; buf, int exp, int sign );&lt;/p&gt;
&lt;p&gt;};&lt;/p&gt;
&lt;p&gt;template&amp;lt;typename T,int BIT&amp;gt;&lt;/p&gt;
&lt;p&gt;Test&amp;lt;T,BIT&amp;gt; operator+(Test&amp;lt;T,BIT&amp;gt;&amp;amp; ss, Test&amp;lt;T,BIT&amp;gt;&amp;amp; tt) &lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; return ss;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;template&amp;lt;class T,int BIT&amp;gt; &lt;/p&gt;
&lt;p&gt;Test&amp;lt;T,BIT&amp;gt; BufRestore( typename Test&amp;lt;T,BIT&amp;gt;::_BUF&amp;amp; buf, int exp, int sign )&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	typename Test&amp;lt;T,BIT&amp;gt;::_BUF&amp;amp; b1;&lt;/p&gt;
&lt;p&gt;	Test&amp;lt;T,BIT&amp;gt; rv;&lt;/p&gt;
&lt;p&gt;	return rv;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;int _tmain(int argc, _TCHAR* argv[])&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	Test&amp;lt;int,8&amp;gt; t,t1,t2;&lt;/p&gt;
&lt;p&gt;	Test&amp;lt;int,8&amp;gt;::_BUF b1;&lt;/p&gt;
&lt;p&gt;	t = t1+t2;&lt;/p&gt;
&lt;p&gt;	t2 = BufRestore( b1, 10, 0);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; return 0;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Errors VC2005 issue:&lt;/p&gt;
&lt;p&gt;Compiling...&lt;/p&gt;
&lt;p&gt;Test.cpp&lt;/p&gt;
&lt;p&gt;Compiling manifest to resources...&lt;/p&gt;
&lt;p&gt;Linking...&lt;/p&gt;
&lt;p&gt;Test.obj : error LNK2019: unresolved external symbol &amp;quot;class Test&amp;lt;int,8&amp;gt; __cdecl BufRestore(struct Test&amp;lt;int,8&amp;gt;::_BUF &amp;amp;,int,int)&amp;quot; (?BufRestore@@YA?AV?$Test@H$07@@AAU_BUF@1@HH@Z) referenced in function _wmain&lt;/p&gt;
&lt;p&gt;C:\Documents and Settings\Richard\My Documents\Visual Studio 2005\Projects\Test\Debug\Test.exe : fatal error LNK1120: 1 unresolved externals&lt;/p&gt;
&lt;p&gt;Build log was saved at &amp;quot;file://c:\Documents and Settings\Richard\My Documents\Visual Studio 2005\Projects\Test\Debug\BuildLog.htm&amp;quot;&lt;/p&gt;
&lt;p&gt;Test - 2 error(s), 0 warning(s)&lt;/p&gt;
</description></item></channel></rss>