error: ISO C++ forbids casting between pointer-to-function and pointer-to-object

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

error: ISO C++ forbids casting between pointer-to-function and pointer-to-object

Eduardo Montoya
Hi QuantLibers, :)

I am trying to compile the QuantLibAddIn under Linux and I am getting the following error:

../../../qlo/enumerations/factories/conundrumpricerfactory.hpp:44: error: ISO C++ forbids casting between pointer-to-function and pointer-to-object

the content of this file is:

      1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
      2
      3 /*
      4  Copyright (C) 2005 Plamen Neykov
      5  Copyright (C) 2006, 2007 Eric Ehlers
      6
      7  This file is part of QuantLib, a free-software/open-source library
      8  for financial quantitative analysts and developers - http://quantlib.org/
      9
     10  QuantLib is free software: you can redistribute it and/or modify it
     11  under the terms of the QuantLib license.  You should have received a
     12  copy of the license along with this program; if not, please email
     13  <[hidden email]>. The license is also available online at
     14  <http://quantlib.org/license.shtml>.
     15
     16  This program is distributed in the hope that it will be useful, but WITHOUT
     17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     18  FOR A PARTICULAR PURPOSE.  See the license for more details.
     19 */
     20
     21 #ifndef qla_conundrumpricerfactory_hpp
     22 #define qla_conundrumpricerfactory_hpp
     23
     24 #include <oh/enumerations/typefactory.hpp>
     25 #include <ql/cashflows/conundrumpricer.hpp>
     26
     27 namespace ObjectHandler {
     28
     29     typedef boost::shared_ptr<QuantLib::CmsCouponPricer>(*CmsCouponPricerConstructor)(
     30             const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& swaptionVol,
     31             const QuantLib::GFunctionFactory::YieldCurveModel modelOfYieldCurve,
     32             const QuantLib::Handle<QuantLib::Quote>& meanReversion);
     33
     34     template<>
     35     class Create<boost::shared_ptr<QuantLib::CmsCouponPricer> > :
     36         private RegistryManager<QuantLib::CmsCouponPricer, EnumClassRegistry> {
     37     public:
     38         boost::shared_ptr<QuantLib::CmsCouponPricer> operator() (
     39                 const std::string& CmsCouponPricerID,
     40                 const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& swaptionVol,
     41                 const QuantLib::GFunctionFactory::YieldCurveModel modelOfYieldCurve,
     42                 const QuantLib::Handle<QuantLib::Quote>& meanReversion) {
     43             CmsCouponPricerConstructor cmsCouponPricerConstructor =
     44                 reinterpret_cast<CmsCouponPricerConstructor>(getType(CmsCouponPricerID));
     45             return cmsCouponPricerConstructor(swaptionVol,modelOfYieldCurve, meanReversion);
     46         }
     47         using RegistryManager<QuantLib::CmsCouponPricer, EnumClassRegistry>::registerType;
     48     };
     49  }
     50
     51 #endif

I have been looking on the net about this error and it seems that gcc behaves that way! I wonder if there is a way to do the same with gcc!
I wonder if someone have compiled this library under linux!

I have used the following tutorial. (the versions of all packages are 0.9.7)

http://quantlib.org/quantlibaddin/build_cpp.html

and the version of gcc is:

g++ (GCC) 3.4.6 20060404 (Red Hat 3.4.6-8)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


please let me know if anyone has some advice in order to resolve this problem!

thanks,

Eduardo

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users