Menu

#183 Broken build on Visual Studio

closed-fixed
None
5
2012-04-02
2012-03-20
King_DuckZ
No

Version 1177 on trunk doesn't build on VS 2005/2008. The problem is in a template method being instantiated with a reference as its template type T. The function then takes a T& argument, that results in a reference to a reference. In C++99 this is forbidden (cf. Standard §8.3.4).
My solution was to use TypeTraits::ParameterType, but this has a couple disadvantages:
1) a dependency to TypeTraits.h in SafeFormat.h is added
2) automatic template deduction won't work anymore

At least problem 1 could be solved by writing a "small" replacement for TypeTraits::ParameterType, which can be put in a leaf .h and reused elsewhere (that's a very low level feature IMO to carry any dependency).
Unfortunately I couldn't spend too much time on the code, so maybe there's a better solution I don't see.

Discussion

  • King_DuckZ

    King_DuckZ - 2012-03-20

    proposed patch patch

     
  • King_DuckZ

    King_DuckZ - 2012-03-20

    Apparently the problem was introduced at revision 1160 "Added functions that print directly to cout"

     
  • Richard Sposato

    Richard Sposato - 2012-04-02
    • assigned_to: nobody --> rich_sposato
    • status: open --> closed-fixed
     
  • Richard Sposato

    Richard Sposato - 2012-04-02

    Fixed in revision 1179.
    Added use of Loki::TypeTraits.

     

Log in to post a comment.