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

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


#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
 Keywords: log static const |
---------------------------------------+---------------------
 Static const variables cannot be logged for me any more. I am using RHEL
 7.1 and the Intel icpc for my programms (boost compiled with gcc 4.8.3)

 The following code does not work in 1.60.0 but does in 1.59.0
 Maybe it has to do with the changes regarding formatting_ostream #11549 or
 #11545

 Code:
 {{{
 /*
  * File: main.cpp
  * Author: hschall
  *
  * Created on February 18, 2016, 6:53 AM
  */

 #include <cstdlib>
 #define BOOST_LOG_DYN_LINK
 #include <boost/log/trivial.hpp>

 class TestStaticError{
     public:
         static void doLog(){
           BOOST_LOG_TRIVIAL(debug) << myVar;
         }
     private:
         static const unsigned int myVar = 1337;
 };

 class TestStaticWorking{
     public:
         static void doLog(){
             BOOST_LOG_TRIVIAL(debug) << (unsigned int)myVar;
         }
     private:
         static const unsigned int myVar = 1337;
 };

 using namespace std;

 /*
  *
  */
 int main(int argc, char** argv){

   TestStaticWorking::doLog(); // Works

   // Works in 1.59.0
   //TestStaticError::doLog(); // main.cpp:21: undefined reference to
 `TestStaticError::myVar'

   return 0;
 }
 }}}

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