piecewiseyoyinflationcurve: compilation error using MS VC9 (2008)

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

piecewiseyoyinflationcurve: compilation error using MS VC9 (2008)

Ferdinando M. Ametrano-3
Hi all

Compiling...
yoycapfloortermpricesurface.cpp
.\ql/termstructures/inflation/piecewiseyoyinflationcurve.hpp(127) :
error C2059: syntax error : '<'
        .\ql/termstructures/inflation/piecewiseyoyinflationcurve.hpp(130)
: see reference to class template instantiation
'QuantLib::PiecewiseYoYInflationCurve<Interpolator,Bootstrap,Traits>'
being compiled
.\ql/termstructures/inflation/piecewiseyoyinflationcurve.hpp(127) :
error C2238: unexpected token(s) preceding ';'

no problem using VC8

ciao -- Nando

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: piecewiseyoyinflationcurve: compilation error using MS VC9 (2008)

Luigi Ballabio
On Fri, 2009-02-20 at 16:44 +0100, Ferdinando Ametrano wrote:

> Compiling...
> yoycapfloortermpricesurface.cpp
> .\ql/termstructures/inflation/piecewiseyoyinflationcurve.hpp(127) :
> error C2059: syntax error : '<'
>         .\ql/termstructures/inflation/piecewiseyoyinflationcurve.hpp(130)
> : see reference to class template instantiation
> 'QuantLib::PiecewiseYoYInflationCurve<Interpolator,Bootstrap,Traits>'
> being compiled
> .\ql/termstructures/inflation/piecewiseyoyinflationcurve.hpp(127) :
> error C2238: unexpected token(s) preceding ';'
>
> no problem using VC8

Go figure...  We can only try to move stuff around and see if it's more
digestible.  Try replacing the offending line

friend class Bootstrap<this_curve>;

with

typedef typename Bootstrap<this_curve> bootstrapper;
friend class bootstrapper;

Luigi


--

The First Rule of Optimization: Don't do it.
The Second Rule of Optimization (For experts only): Don't do it yet.
-- Michael Jackson



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: piecewiseyoyinflationcurve: compilation error using MS VC9 (2008)

Andreas Spengler-2
Guys,

sorry for entering this thread, too, but

> Try replacing the offending line
>
> friend class Bootstrap<this_curve>;
>
> with
>
> typedef typename Bootstrap<this_curve> bootstrapper;
> friend class bootstrapper;

Compiling the "Bond" example breaks in exactly the same line with SUN CC:

"../../ql/termstructures/yield/piecewiseyieldcurve.hpp", line 149: Error,
notempname: A class template name was expected instead of
QuantLib::Bootstrap<QuantLib::Curve>.
"Bonds.cpp", line 214:     Where, temwhilespec: While specializing
"QuantLib::PiecewiseYieldCurve<QuantLib::Discount, QuantLib::LogLinear,
QuantLib::IterativeBootstrap<QuantLib::Curve>>".
"Bonds.cpp", line 214:     Where, temspecend: Specialized in non-template
code.
"../../ql/termstructures/yield/piecewiseyieldcurve.hpp", line 149: Error,
nofriendfield: A "friend" declaration must specify a class or function.
"Bonds.cpp", line 214:     Where, temwhilespec: While specializing
"QuantLib::PiecewiseYieldCurve<QuantLib::Discount, QuantLib::LogLinear,
QuantLib::IterativeBootstrap<QuantLib::Curve>>".
"Bonds.cpp", line 214:     Where, temspecend: Specialized in non-template
code.
2 Error(s) and 6 Warning(s) detected.

Changing to the above didn't help...

Rgds,

Andreas


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: piecewiseyoyinflationcurve: compilation error using MS VC9 (2008)

Luigi Ballabio
On Fri, 2009-02-20 at 18:01 +0100, Andreas Spengler wrote:
> Compiling the "Bond" example breaks in exactly the same line with SUN CC:
>
> [...]
>
> Changing to [the suggested fix] didn't help...

Hmm. At least it worked for VC++9... may you try shuffling things around
and see if you get it to compile in some way?

Luigi


--

The shortest way to do many things is to do only one thing at once.
-- Samuel Smiles



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: piecewiseyoyinflationcurve: compilation error using MS VC9 (2008)

Andreas Spengler-2
In reply to this post by Ferdinando M. Ametrano-3
Hi,

> Hmm. At least it worked for VC++9... may you try shuffling things around
> and see if you get it to compile in some way?

The SUN compiler does not understand friend declarations using templated
classes.

A work-around that compiles, strangely enough, is to remove the "class" in

friend class Bootstrap<this_curve>;


I don't know whether you want to put this in the repository, though ;-)


Rgds,

Andreas
--
http://aspengler.blogspot.com




------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: piecewiseyoyinflationcurve: compilation error using MS VC9 (2008)

Luigi Ballabio
On Wed, 2009-02-25 at 10:40 +0100, Andreas Spengler wrote:
> The SUN compiler does not understand friend declarations using templated
> classes.
>
> A work-around that compiles, strangely enough, is to remove the "class" in
>
> friend class Bootstrap<this_curve>;
>
>
> I don't know whether you want to put this in the repository, though ;-)

Only conditionally... Let's try to turn this into a configure test.
I've stripped the guilty file to a minimum and I'm attaching it to this
post. Can you check that if you run
    g++ -c test.cpp
(or whatever your C++ compiler is called) it does NOT compile, but it
does when you remove the "class" keyword?

Thanks,
        Luigi

P.S. Another try: does the original file compile if you keep the
"class", but replace this_curve in the friend declaration with the full
type? (Piecewise...<Interpolation,etc.etc>)

Luigi


--

Newton's Law of Gravitation:
What goes up must come down. But don't expect it to come down
where you can find it. Murphy's Law applies to Newton's.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

test.cpp (156 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: piecewiseyoyinflationcurve: compilation error using MS VC9 (2008)

Andreas Spengler-2
Hi,

Es schrieb Luigi Ballabio

>> I don't know whether you want to put this in the repository, though ;-)
>
> Only conditionally... Let's try to turn this into a configure test.
> I've stripped the guilty file to a minimum and I'm attaching it to this
> post. Can you check that if you run
>     g++ -c test.cpp
> (or whatever your C++ compiler is called) it does NOT compile, but it
> does when you remove the "class" keyword?

Will do.

> P.S. Another try: does the original file compile if you keep the
> "class", but replace this_curve in the friend declaration with the full
> type? (Piecewise...<Interpolation,etc.etc>)

I tried this already, and no, it doesn't...

Rgds,

Andreas


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev