[ quantlib-Bugs-3307791 ] g++ complains about mutable variables

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

[ quantlib-Bugs-3307791 ] g++ complains about mutable variables

SourceForge.net
Bugs item #3307791, was opened at 2011-05-26 03:07
Message generated for change (Comment added) made by fak98
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3307791&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: charas (benyam)
Assigned to: Nobody/Anonymous (nobody)
Summary: g++ complains about mutable variables

Initial Comment:
While building a package for quantlib on  archlinux i got the following warning and error  

reference 'y2_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:277:34: warning: reference 'v_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:336:33: warning: reference 'y2_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:34: warning: reference 'v_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:39: warning: reference 'v1_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:45: warning: reference 'v2_' cannot be declared 'mutable' [-fpermissive]
make[2]: *** [BermudanSwaption.o] Error 1

After compiling with -fpermissive I could get it compiled but the  warnings are still there whenever the compiler encounters
the mutable variables.

Thanks for Quantlib


----------------------------------------------------------------------

Comment By: Fahad Khan (fak98)
Date: 2011-06-21 18:07

Message:
I don't get any such issues on Fedora 15. Both on QuantLib-1.1 and trunk

$ gcc --version
gcc (GCC) 4.6.0 20110509 (Red Hat 4.6.0-7)


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3307791&group_id=12740

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: [ quantlib-Bugs-3307791 ] g++ complains about mutable variables

Amir Ahmed Ansari-2
I haven't looked at the code responsible for this, but for anyone wishing to resolve it, here is one tidbit that may be useful. The mutable C++ keyword is not meaningful on reference member variables. That is because the 'const' keyword applies ONLY to the class members, NOT what they might be pointing to. So, the following will execute without any compiler errors:

class A
{
public:

    mutable int & i;
    int a;

    A() : i(a) {}

};

int main()
{
    const A a;
    a.i = 1;

     return 0;
}

NOTE that this isn't an example you should copy, because changing those members of a const object that are not marked 'mutable' can lead to very subtle bugs. What I am trying to explain is that the mutable keyword is irrelevant on class members that are references. Hope this helps!!!!

----- Original Message -----
From: SourceForge.net <[hidden email]>
To: [hidden email]
Cc:
Sent: Tuesday, June 21, 2011 10:07 PM
Subject: [Quantlib-dev] [ quantlib-Bugs-3307791 ] g++ complains about mutable variables

Bugs item #3307791, was opened at 2011-05-26 03:07
Message generated for change (Comment added) made by fak98
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3307791&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: charas (benyam)
Assigned to: Nobody/Anonymous (nobody)
Summary: g++ complains about mutable variables

Initial Comment:
While building a package for quantlib on  archlinux i got the following warning and error 

reference 'y2_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:277:34: warning: reference 'v_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:336:33: warning: reference 'y2_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:34: warning: reference 'v_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:39: warning: reference 'v1_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:45: warning: reference 'v2_' cannot be declared 'mutable' [-fpermissive]
make[2]: *** [BermudanSwaption.o] Error 1

After compiling with -fpermissive I could get it compiled but the  warnings are still there whenever the compiler encounters
the mutable variables.

Thanks for Quantlib


----------------------------------------------------------------------

Comment By: Fahad Khan (fak98)
Date: 2011-06-21 18:07

Message:
I don't get any such issues on Fedora 15. Both on QuantLib-1.1 and trunk

$ gcc --version
gcc (GCC) 4.6.0 20110509 (Red Hat 4.6.0-7)


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3307791&group_id=12740

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: [ quantlib-Bugs-3307791 ] g++ complains about mutable variables

Amir Ahmed Ansari-2
sorry, what I wanted to show was this compiles without any errors:

class A
{
public:

    int & i;
    int a;

    A() : i(a) {}

};

int main()
{
    const A a;
    a.i = 1;

     return 0;
}



From: Amir Ahmed Ansari <[hidden email]>
To: "[hidden email]" <[hidden email]>
Sent: Wednesday, June 22, 2011 2:23 PM
Subject: Re: [Quantlib-dev] [ quantlib-Bugs-3307791 ] g++ complains about mutable variables

I haven't looked at the code responsible for this, but for anyone wishing to resolve it, here is one tidbit that may be useful. The mutable C++ keyword is not meaningful on reference member variables. That is because the 'const' keyword applies ONLY to the class members, NOT what they might be pointing to. So, the following will execute without any compiler errors:

class A
{
public:

    mutable int & i;
    int a;

    A() : i(a) {}

};

int main()
{
    const A a;
    a.i = 1;

     return 0;
}

NOTE that this isn't an example you should copy, because changing those members of a const object that are not marked 'mutable' can lead to very subtle bugs. What I am trying to explain is that the mutable keyword is irrelevant on class members that are references. Hope this helps!!!!

----- Original Message -----
From: SourceForge.net <[hidden email]>
To: [hidden email]
Cc:
Sent: Tuesday, June 21, 2011 10:07 PM
Subject: [Quantlib-dev] [ quantlib-Bugs-3307791 ] g++ complains about mutable variables

Bugs item #3307791, was opened at 2011-05-26 03:07
Message generated for change (Comment added) made by fak98
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3307791&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: charas (benyam)
Assigned to: Nobody/Anonymous (nobody)
Summary: g++ complains about mutable variables

Initial Comment:
While building a package for quantlib on  archlinux i got the following warning and error 

reference 'y2_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:277:34: warning: reference 'v_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:336:33: warning: reference 'y2_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:34: warning: reference 'v_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:39: warning: reference 'v1_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:45: warning: reference 'v2_' cannot be declared 'mutable' [-fpermissive]
make[2]: *** [BermudanSwaption.o] Error 1

After compiling with -fpermissive I could get it compiled but the  warnings are still there whenever the compiler encounters
the mutable variables.

Thanks for Quantlib


----------------------------------------------------------------------

Comment By: Fahad Khan (fak98)
Date: 2011-06-21 18:07

Message:
I don't get any such issues on Fedora 15. Both on QuantLib-1.1 and trunk

$ gcc --version
gcc (GCC) 4.6.0 20110509 (Red Hat 4.6.0-7)


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3307791&group_id=12740

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev



------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: [ quantlib-Bugs-3307791 ] g++ complains aboutmutable variables

YuHong-4
In reply to this post by Amir Ahmed Ansari-2
 
Since I don’t hit such problems on Ubuntu-Linux, and I currently don’t have own computer space to install Fedora, therefore I am happy and interested to help, if I can get access to Fedora via SSH/SFTP etc. via any of your help.  Thanks.
 
 
 
Sent: Wednesday, June 22, 2011 5:23 PM
Subject: Re: [Quantlib-dev] [ quantlib-Bugs-3307791 ] g++ complains aboutmutable variables
 
I haven't looked at the code responsible for this, but for anyone wishing to resolve it, here is one tidbit that may be useful. The mutable C++ keyword is not meaningful on reference member variables. That is because the 'const' keyword applies ONLY to the class members, NOT what they might be pointing to. So, the following will execute without any compiler errors:

class A
{
public:

    mutable int & i;
    int a;

    A() : i(a) {}

};

int main()
{
    const A a;
    a.i = 1;

     return 0;
}

NOTE that this isn't an example you should copy, because changing those members of a const object that are not marked 'mutable' can lead to very subtle bugs. What I am trying to explain is that the mutable keyword is irrelevant on class members that are references. Hope this helps!!!!
 
----- Original Message -----
From: SourceForge.net <[hidden email]>
To: [hidden email]
Cc:
Sent: Tuesday, June 21, 2011 10:07 PM
Subject: [Quantlib-dev] [ quantlib-Bugs-3307791 ] g++ complains about mutable variables

Bugs item #3307791, was opened at 2011-05-26 03:07
Message generated for change (Comment added) made by fak98
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3307791&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: charas (benyam)
Assigned to: Nobody/Anonymous (nobody)
Summary: g++ complains about mutable variables

Initial Comment:
While building a package for quantlib on  archlinux i got the following warning and error 

reference 'y2_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:277:34: warning: reference 'v_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:336:33: warning: reference 'y2_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:34: warning: reference 'v_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:39: warning: reference 'v1_' cannot be declared 'mutable' [-fpermissive]
../ql/math/interpolations/multicubicspline.hpp:337:45: warning: reference 'v2_' cannot be declared 'mutable' [-fpermissive]
make[2]: *** [BermudanSwaption.o] Error 1

After compiling with -fpermissive I could get it compiled but the  warnings are still there whenever the compiler encounters
the mutable variables.

Thanks for Quantlib


----------------------------------------------------------------------

Comment By: Fahad Khan (fak98)
Date: 2011-06-21 18:07

Message:
I don't get any such issues on Fedora 15. Both on QuantLib-1.1 and trunk

$ gcc --version
gcc (GCC) 4.6.0 20110509 (Red Hat 4.6.0-7)


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3307791&group_id=12740

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev


_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev