title: Upgrading to G++ 4.8 - exception_ptr.h Does not support exception propagation
body: <p>I'm trying to recompile a huge legacy app with g++ 4.8 in order debug a <code>glibc detected memory corruption</code> problem (using AddressSanitizer).  Previously we used g++ 4.4.7.</p>
  
  <p>However, compilation fails with:</p>
  
  <p><code>/opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/bits/exception_ptr.h:40:4: error: #error This platform does not support exception propagation.</code></p>
  
  <p>while compiling a custom exception handler (I guess). The custom exception handler uses <code>exception_ptr</code> in only one place:</p>
  
  <pre><code>void reportOtherException(void) const
  {
      std::exception_ptr p = std::current_exception();
      std::string s = (p != 0 ? p.__cxa_exception_type()-&gt;name() : "null");
  
      printf("DvMain Bad Exception: '%s'\n", s.c_str());
      mErrorReporter(0, DvLog::WARNING, 0, Dv::NO_PROFILE, 0, DvLog::UNHANDLED_OTHER_EXCEPTION);
  }
  </code></pre>
  
  <p>And <code>reportOtherException()</code> is used like this:</p>
  
  <pre><code>try
  {
      // Catch and log uncaught exceptions, then exit.
      catch (const std::bad_exception&amp; e) { exHandler.reportBadException(e);      }
      catch (const std::exception&amp; e)     { exHandler.reportStandardException(e); }
      catch (...)                         { exHandler.reportOtherException();     }
  }
  </code></pre>
  
  <p>I'm pretty new to C++ and don't know what the error even means. Worked with 4.4.7 and doesn't work with 4.8.</p>
  
  <p>Any pointers on what needs to be changed to compile on 4.8?</p>
  
  <p><strong>EDIT I</strong></p>
  
  <p>Here's some additional info:</p>
  
  <pre><code>g++ --version
  g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
  </code></pre>
  
  <p><strong>Minimum Code</strong></p>
  
  <p><em>DvComDefaultExceptionHandler_test.h</em></p>
  
  <pre><code>#include "DvCommon.h"
  #include "evt/DvEvt.h"
  #include "log/DvLog.h"
  #include "com/DvComErrorReporter.h"
  
  #include &lt;new&gt;
  #include &lt;exception&gt;
  #include &lt;sys/time.h&gt;
  #include &lt;sys/resource.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;malloc.h&gt;
  #include &lt;bits/exception_ptr.h&gt;
  
  class DvComDefaultExceptionHandler
  {
  public:
      DvComDefaultExceptionHandler(const DvComErrorReporter&amp; er) {}
      ~DvComDefaultExceptionHandler() {   }
  
      void reportOtherException(void) const
      {
          std::exception_ptr p = std::current_exception();
      }
  
  private:
  
      static const DvComDefaultExceptionHandler*  mpInstance;
  };
  </code></pre>
  
  <p><em>DvComDefaultExceptionHandler_test.cpp</em></p>
  
  <pre><code>#include "DvCommon.h"
  #include "com/DvComDefaultExceptionHandler_test.h"
  
  
  // Pointer to the single instance of the DvComDefaultExceptionHandler class.
  const DvComDefaultExceptionHandler*
  DvComDefaultExceptionHandler::mpInstance = 0;
  </code></pre>
  
  <p><em>Compile command and output</em></p>
  
  <pre><code>g++ -c -g -O0  -DDEBUG -Wall -Wextra -Wno-sign-compare -Wcast-align 
  --ftemplate-depth-32 -march=native -ggdb -fPIC -Iinclude -I../../include 
  -I../../src -I/usr/include/libxml2 -D_GNU_SOURCE   
  -I/mnt/swdevel/DVMon/source_build/ext/ACE -D__ACE_INLINE__ 
  -I/usr/local/include -I/usr/lib/qt-3.3/include 
  -o DvComDefaultExceptionHandler.o DvComDefaultExceptionHandler_test.cpp
  In file included from ../../include/com/DvComDefaultExceptionHandler_test.h:76:0,
                   from DvComDefaultExceptionHandler_test.cpp:13:
  /opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/bits/exception_ptr.h:40:4: error: #error This platform does not support exception propagation.
   #  error This platform does not support exception propagation.
  </code></pre>
  
  <p><strong>EDIT II</strong></p>
  
  <p>Tracing through the include files comes down to the value of __GCC_ATOMIC_INT_LOCK_FREE.  Running this simple program prints '2' as the value for __GCC_ATOMIC_INT_LOCK_FREE.</p>
  
  <pre><code>int
  main(int argc, char **argv)
  {
      printf("__GCC_ATOMIC_INT_LOCK_FREE = %d\n", __GCC_ATOMIC_INT_LOCK_FREE);
  }
  </code></pre>
  
  <p>G++ VERSION:</p>
  
  <pre><code>$ g++ --version
  g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
  </code></pre>
  
  <p><strong>EDIT II</strong></p>
  
  <p>I've tried it with g++ 6.3.1, running on a Centos 7 VM.  Still the same problem.</p>
  
  <p><em>Source File - one line only</em></p>
  
  <pre><code>#include &lt;bits/exception_ptr.h&gt;
  </code></pre>
  
  <p>Compile command:  <code>g++ -c -o test.o test.cpp</code></p>