I'm trying to recompile a huge legacy app with g++ 4.8 in order debug a `glibc detected memory corruption` problem (using AddressSanitizer). Previously we used g++ 4.4.7.

However, compilation fails with:

`/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.`

while compiling a custom exception handler (I guess). The custom exception handler uses `exception_ptr` in only one place:

```
void reportOtherException(void) const
{
    std::exception_ptr p = std::current_exception();
    std::string s = (p != 0 ? p.__cxa_exception_type()->name() : "null");

    printf("DvMain Bad Exception: '%s'\n", s.c_str());
    mErrorReporter(0, DvLog::WARNING, 0, Dv::NO_PROFILE, 0, DvLog::UNHANDLED_OTHER_EXCEPTION);
}

```

And `reportOtherException()` is used like this:

```
try
{
    // Catch and log uncaught exceptions, then exit.
    catch (const std::bad_exception& e) { exHandler.reportBadException(e);      }
    catch (const std::exception& e)     { exHandler.reportStandardException(e); }
    catch (...)                         { exHandler.reportOtherException();     }
}

```

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.

Any pointers on what needs to be changed to compile on 4.8?

**EDIT I**

Here's some additional info:

```
g++ --version
g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)

```

**Minimum Code**

*DvComDefaultExceptionHandler\_test.h*

```
#include "DvCommon.h"
#include "evt/DvEvt.h"
#include "log/DvLog.h"
#include "com/DvComErrorReporter.h"

#include <new>
#include <exception>
#include <sys/time.h>
#include <sys/resource.h>
#include <stdlib.h>
#include <unistd.h>
#include <malloc.h>
#include <bits/exception_ptr.h>

class DvComDefaultExceptionHandler
{
public:
    DvComDefaultExceptionHandler(const DvComErrorReporter& er) {}
    ~DvComDefaultExceptionHandler() {   }

    void reportOtherException(void) const
    {
        std::exception_ptr p = std::current_exception();
    }

private:

    static const DvComDefaultExceptionHandler*  mpInstance;
};

```

*DvComDefaultExceptionHandler\_test.cpp*

```
#include "DvCommon.h"
#include "com/DvComDefaultExceptionHandler_test.h"

// Pointer to the single instance of the DvComDefaultExceptionHandler class.
const DvComDefaultExceptionHandler*
DvComDefaultExceptionHandler::mpInstance = 0;

```

*Compile command and output*

```
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.

```

**EDIT II**

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.

```
int
main(int argc, char **argv)
{
    printf("__GCC_ATOMIC_INT_LOCK_FREE = %d\n", __GCC_ATOMIC_INT_LOCK_FREE);
}

```

G++ VERSION:

```
$ g++ --version
g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)

```

**EDIT II**

I've tried it with g++ 6.3.1, running on a Centos 7 VM. Still the same problem.

*Source File - one line only*

```
#include <bits/exception_ptr.h>

```

Compile command: `g++ -c -o test.o test.cpp`