C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: volatile type copy constructor

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Ron Natalie
Guest





PostPosted: Fri Jul 25, 2003 2:22 pm    Post subject: Re: volatile type copy constructor Reply with quote




"Gwang Sik Yoon" <gsyoon (AT) salmosa (DOT) kaist.ac.kr> wrote

Quote:
The following code is meant to assign a volatile return value to a
variable. But the compiler can't find the seemingly correct copy
constructor. Interestingly, there's no problem in assigning a volatile
variable to a variable.

I think you may want an
X(const volatile&)
copy constructor. The return value is an rvalue and can't be bound
to a non-const reference.




Back to top
Gwang Sik Yoon
Guest





PostPosted: Mon Aug 04, 2003 8:24 am    Post subject: Re: volatile type copy constructor Reply with quote



"Ron Natalie" <ron (AT) sensor (DOT) com> wrote

Quote:
"Gwang Sik Yoon" <gsyoon (AT) salmosa (DOT) kaist.ac.kr> wrote

The following code is meant to assign a volatile return value to a
variable. But the compiler can't find the seemingly correct copy
constructor. Interestingly, there's no problem in assigning a volatile
variable to a variable.

I think you may want an
X(const volatile&)
copy constructor. The return value is an rvalue and can't be bound
to a non-const reference.

I tried that also and failed. Sad
Your last sentence seems to imply that

const volatile X h() {.... } ;
const volatile X var_a = h() ;

should work.
var_a is a const reference. isn't it?
However, it doesn't work either.

Am I missing or mis-interpreting something here?


Can you give me some references for your last sentece?
I have read a few books on C++ such as The C++ Programming Language,
C++ FAQs, etc, but can't remember any phrases that
say volatiles are rvalues.

Thanks for your help again. :)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.