Boost C++ Libraries: Ticket #12135: Boost.Concepts shoudn't create typedefs based on line number https://svn.boost.org/trac10/ticket/12135 <p> Hey so today I spent about 30 minutes tearing my hair out over this compile error: </p> <blockquote> <p> error: typedef redefinition with different types ('instantiate&lt;&amp;::boost::concepts::requirement_&lt;void (*)(concept::Window&lt;qt_window&gt;)&gt;::failed&gt;' vs 'instantiate&lt;&amp;::boost::concepts::requirement_&lt;void (*)(concept::Viewport&lt;qt_viewport&gt;)&gt;::failed&gt;') </p> </blockquote> <p> This error isn't useful to what was happening. I had two BOOST_CONCEPT_ASSERT((...))s in two different files, under the global namespace. At first I theorized that it wasn't just supported but according to the docs BOOST_CONCEPT_ASSERT can be used in any scope. Then I started to look at the implementation and found this line: BOOST_PP_CAT(boost_concept_check,<span class="underline">LINE</span>) which gave it all away: they were both on the same line. The thing is that I use a code formatter, so I actually have to add comments or code to change the line number a line of code is on. </p> <p> I would love this to be fixed. There is a fine workaround, but it isn't a very easy to find error in your code. </p> <p> Here is a simple test case. Just add a newline before the BOOST_CONCEPT_ASSERT((...)) in either of the headers to get rid of the error: </p> <div class="wikipage" style="font-size: 80%"><p> Code highlighting: </p> <div class="wiki-code"><div class="code"><pre><span class="c1">// a.h</span> <span class="cp">#include</span> <span class="cpf">&lt;boost/concept_check.hpp&gt;</span><span class="cp"></span> <span class="n">BOOST_CONCEPT_ASSERT</span><span class="p">((</span><span class="n">boost</span><span class="o">::</span><span class="n">Integer</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="p">));</span> <span class="c1">// note line number</span> </pre></div></div></div><div class="wikipage" style="font-size: 80%"><p> Code highlighting: </p> <div class="wiki-code"><div class="code"><pre><span class="c1">// b.h</span> <span class="cp">#include</span> <span class="cpf">&lt;boost/concept_check.hpp&gt;</span><span class="cp"></span> <span class="n">BOOST_CONCEPT_ASSERT</span><span class="p">((</span><span class="n">boost</span><span class="o">::</span><span class="n">UnsignedInteger</span><span class="o">&lt;</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="o">&gt;</span><span class="p">));</span> <span class="c1">// note line number</span> </pre></div></div></div><div class="wikipage" style="font-size: 80%"><p> Code highlighting: </p> <div class="wiki-code"><div class="code"><pre><span class="c1">// main.cpp</span> <span class="cp">#include</span> <span class="cpf">&quot;a.h&quot;</span><span class="cp"></span> <span class="cp">#incldue &quot;b.h&quot;</span> <span class="kt">int</span> <span class="nf">main</span><span class="p">(){}</span> </pre></div></div></div> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12135 Trac 1.4.3