Compiler bug in Market Models???

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiler bug in Market Models???

Joseph Wang-2
Need a language lawyer :-) :-) :-)

g++ 4.0 on Linux is choking on

        EvolutionDescription(
            const Array& rateTimes,
            const Array& evolutionTimes,
            const std::vector<Size>& numeraires = std::vector<Size>(),
            const  std::vector<std::pair<Size,Size> >  &relevanceRates =
                                    std::vector<std::pair<Size,Size> >  ());

with

../../ql/MarketModels/evolutiondescription.hpp:62: error: expected ‘,’
or ‘...’ before ‘>’ token
../../ql/MarketModels/evolutiondescription.hpp:62: error: wrong number of
template arguments (1, should be 2)
/usr/lib/gcc/i586-mandriva-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bits/stl_pair.h:68:
error: provided for ‘template<class _T1, class _T2> struct std::pair’
../../ql/MarketModels/evolutiondescription.hpp:62: error: template argument 1
is invalid
../../ql/MarketModels/evolutiondescription.hpp:62: error: template argument 2
is invalid
../../ql/MarketModels/evolutiondescription.hpp:62: error: default argument
missing for parameter 5
of ‘QuantLib::EvolutionDescription::EvolutionDescription(const
QuantLib::Array&, const QuantLib::Array&, const std::vector<unsigned int,
std::allocator<unsigned int> >&, const std::vector<std::pair<unsigned int,
unsigned int>, std::allocator<std::pair<unsigned int, unsigned int> > >&,
QuantLib::Size)’

But it works if I typedef the template

        typedef std::vector<std::pair<Size,Size> > RelevanceRatesType;
        EvolutionDescription(
            const Array& rateTimes,
            const Array& evolutionTimes,
            const std::vector<Size>& numeraires = std::vector<Size>(),
            const  std::vector<std::pair<Size,Size> >  &relevanceRates =
                                    RelevanceRatesType ());

is G++ broken?


Reply | Threaded
Open this post in threaded view
|

Re: Compiler bug in Market Models???

Joseph Wang-2
Doing some more googling, it turns out that this really does require a
language lawyer, since it involves an issue in the C++ standard, that the
standards committee not resolved yet.

See

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57

for the gory details.  The g++ have a patch that will parse the code, but they
haven't applied it yet pending a decision of the C++ standards committee.



在 Saturday 08 July 2006 23:45,Joseph Wang 写道:

> Need a language lawyer :-) :-) :-)
>
> g++ 4.0 on Linux is choking on
>
>         EvolutionDescription(
>             const Array& rateTimes,
>             const Array& evolutionTimes,
>             const std::vector<Size>& numeraires = std::vector<Size>(),
>             const  std::vector<std::pair<Size,Size> >  &relevanceRates =
>                                     std::vector<std::pair<Size,Size> >
> ());
>
> with
>
> ../../ql/MarketModels/evolutiondescription.hpp:62: error: expected ‘,’
> or ‘...’ before ‘>’ token
> ../../ql/MarketModels/evolutiondescription.hpp:62: error: wrong number of
> template arguments (1, should be 2)
> /usr/lib/gcc/i586-mandriva-linux-gnu/4.1.1/../../../../include/c++/4.1.1/bi
>ts/stl_pair.h:68: error: provided for ‘template<class _T1, class _T2> struct
> std::pair’ ../../ql/MarketModels/evolutiondescription.hpp:62: error:
> template argument 1 is invalid
> ../../ql/MarketModels/evolutiondescription.hpp:62: error: template argument
> 2 is invalid
> ../../ql/MarketModels/evolutiondescription.hpp:62: error: default argument
> missing for parameter 5
> of ‘QuantLib::EvolutionDescription::EvolutionDescription(const
> QuantLib::Array&, const QuantLib::Array&, const std::vector<unsigned int,
> std::allocator<unsigned int> >&, const std::vector<std::pair<unsigned int,
> unsigned int>, std::allocator<std::pair<unsigned int, unsigned int> > >&,
> QuantLib::Size)’
>
> But it works if I typedef the template
>
>         typedef std::vector<std::pair<Size,Size> > RelevanceRatesType;
>         EvolutionDescription(
>             const Array& rateTimes,
>             const Array& evolutionTimes,
>             const std::vector<Size>& numeraires = std::vector<Size>(),
>             const  std::vector<std::pair<Size,Size> >  &relevanceRates =
>                                     RelevanceRatesType ());
>
> is G++ broken?