Re: [Boost-bugs] [Boost C++ Libraries] #11998: Static const variables cannot be logged

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11998: Static const variables cannot be logged
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-02-18 10:02:04


#11998: Static const variables cannot be logged
----------------------------------------+------------------------------
  Reporter: Hendrik Schall <torres@…> | Owner: andysem
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: log
   Version: Boost 1.60.0 | Severity: Problem
Resolution: | Keywords: log static const
----------------------------------------+------------------------------

Comment (by andysem):

 I don't think this is a bug in the library.

 The static constant members have to be defined in some (one) translation
 unit, which gives them storage. In C++11 and later this is required if a
 reference to the variable is taken, which happens when you call the
 `operator<<`. In pre-C++11 versions of the language, IIRC, the definition
 is required unconditionally.

 The type conversion that you use as a workaround makes the `operator<<`
 bind the reference to a temporary, that's why it works. I'm not sure how
 it works differently in 1.59 since I don't see any changes that could lead
 to that but there were such changes since 1.58 - the `operator<<`
 overloads could have been chosen differently before, which would result in
 not taking the reference.

 However, I can see that your use case could be useful, and I'll see if I
 can support it in the future.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11998#comment:1>
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:19 UTC