[Boost-bugs] [Boost C++ Libraries] #9833: "leaking exception" (eg. geometric distribution)

Subject: [Boost-bugs] [Boost C++ Libraries] #9833: "leaking exception" (eg. geometric distribution)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-04-04 06:21:41


#9833: "leaking exception" (eg. geometric distribution)
-------------------------------------+-------------------------
 Reporter: HS Tan <tan@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: math
  Version: Boost Development Trunk | Severity: Showstopper
 Keywords: |
-------------------------------------+-------------------------
 Sorry to label this outright as a "bug" ... it might just be my
 misunderstanding.

 Consider the code included below ... please save it as-is as test.cpp and
 build it with: g++ -o test test.cpp. Then uncomment the #define
 USE_CONFIG_FILE on the first line and repeat the above process to see the
 issue.

 Thank you.[[br]]
 HS

 {{{
 // #define USE_CONFIG_FILE 1

 #ifdef USE_CONFIG_FILE
 #include <boost/math/distributions.hpp>
 #include <boost/math/policies/policy.hpp>

 namespace test
 {
 using namespace boost::math::policies;

 typedef policy<
    domain_error< ignore_error >,
    overflow_error< ignore_error >,
    discrete_quantile< integer_round_up >
> my_boost_policy;

 BOOST_MATH_DECLARE_DISTRIBUTIONS( double, my_boost_policy );
 }
 #else
 #define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error
 #define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
 #define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_up
 #endif

 #include <cstdlib>
 #include <cstdio>

 #include <boost/math/distributions/geometric.hpp>

 int main()
 {
    double _p0 = 1.0;
    double _x = 0.0;

 #ifdef USE_CONFIG_FILE
    test::geometric _dist( _p0 );
 #else
    boost::math::geometric_distribution<> _dist( _p0 );
 #endif /* USE_CONFIG_FILE */

    std::printf(
          "\n"
          " 1-CDF(0,false): %g\n",
          boost::math::cdf(
             boost::math::complement(
                _dist,
                _x ) ) );

    std::printf(
          " CDF(0,false): %g\n\n",
          boost::math::cdf( _dist, _x ) );

    return EXIT_SUCCESS;
 }
 }}}

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