I have the following program:

Code:
#include <iostream>
#include <exception>
#include <stdexcept>

class ExceptionDetector
{
  public:
    ~ExceptionDetector()
    {
      std::exception_ptr ePtr = std::current_exception();
      if (ePtr) std::cout << "Destroyed while handling an exception." << std::endl;
      else std::cout << "Normal destruction." << std::endl;
    }
};

int main(void)
{
  try
  {
    ExceptionDetector detector;

    throw std::runtime_error("foo");
  }
  catch (std::exception& ex)
  {
    std::cout << "Exception caught: " << ex.what() << std::endl;
  }

  return 0;
}
based on the (somewhat vague) description at this link, I'm expecting the destructor to display the message "Destroyed while handling an exception." Unfortunately, this does not seem to be the behavior I'm observing. it always says "Normal destruction."

am I interpreting the description of that function incorrectly, or is it behaving incorrectly? the gcc C++11 standard library status page doesn't even seem to have an entry for std::current_exception(). I want to have some code only run if the object is destroyed normally, but not if it was destroyed during the stack unwinding process of exception handling.

Environment:
Fedora 15 x86_64
Linux kernel 2.6.38
GCC 4.6.3