[Boost-bugs] [Boost C++ Libraries] #12134: Boost.Concepts shoudn't create typedefs based on line number

Subject: [Boost-bugs] [Boost C++ Libraries] #12134: Boost.Concepts shoudn't create typedefs based on line number
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-04-17 23:00:38


#12134: Boost.Concepts shoudn't create typedefs based on line number
------------------------------+---------------------------
 Reporter: russellgreene8@… | Owner: jsiek
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: concept_check
  Version: Boost 1.60.0 | Severity: Problem
 Keywords: Compile Error |
------------------------------+---------------------------
 Hey so today I spent about 30 minutes tearing my hair out over this
 compile error:

  error: typedef redefinition with different types
 ('instantiate<&::boost::concepts::requirement_<void
 (*)(concept::Window<qt_window>)>::failed>' vs
 'instantiate<&::boost::concepts::requirement_<void
 (*)(concept::Viewport<qt_viewport>)>::failed>')

 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,__LINE__) 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.

 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.

 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:

 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!C++
 // a.h
 #include <boost/concept_check.hpp>

 BOOST_CONCEPT_ASSERT((boost::Integer<int>)); // note line number
   }}}
 }}}


 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!C++
 // b.h
 #include <boost/concept_check.hpp>

 BOOST_CONCEPT_ASSERT((boost::UnsignedInteger<unsigned int>)); // note line
 number
   }}}
 }}}


 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!C++
 // main.cpp
 #include "a.h"
 #incldue "b.h"

 int main(){}
   }}}
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12134>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC