Re: [c++0x] cannot return a constant

2010-11-30 Thread Ian Lance Taylor
Roman Kononov writes: > 2010-11-30 15:13 CST, Gabriel Dos Reis > said: >>On Tue, Nov 30, 2010 at 3:11 PM, Roman Kononov wrote: >>> I exactly want to be unable to change an object during its lifetime >>> except when it is moved-and-destroyed. >> >>isn't that a question for C++ forums? > > I hope

Re: [c++0x] cannot return a constant

2010-11-30 Thread Jonathan Wakely
On 30 November 2010 21:45, Gabriel Dos Reis wrote: > On Tue, Nov 30, 2010 at 3:34 PM, Roman Kononov wrote: >> 2010-11-30 21:20 CST, Jonathan Wakely said: >>>We do. The point is your question is off-topic on this list, because >>>you are complaining about the C++0x language, which as far as we kno

Re: [c++0x] cannot return a constant

2010-11-30 Thread Gabriel Dos Reis
On Tue, Nov 30, 2010 at 3:34 PM, Roman Kononov wrote: > 2010-11-30 21:20 CST, Jonathan Wakely said: >>We do. The point is your question is off-topic on this list, because >>you are complaining about the C++0x language, which as far as we know >>GCC implements correctly.  If you don't like the lan

Re: [c++0x] cannot return a constant

2010-11-30 Thread Roman Kononov
2010-11-30 21:20 CST, Jonathan Wakely said: >We do. The point is your question is off-topic on this list, because >you are complaining about the C++0x language, which as far as we know >GCC implements correctly. If you don't like the language, complain >somewhere else. > Then please tell me whic

Re: [c++0x] cannot return a constant

2010-11-30 Thread Jonathan Wakely
On 30 November 2010 21:18, Roman Kononov wrote: > 2010-11-30 15:13 CST, Gabriel Dos Reis > said: >>On Tue, Nov 30, 2010 at 3:11 PM, Roman Kononov wrote: >>> I exactly want to be unable to change an object during its lifetime >>> except when it is moved-and-destroyed. >> >>isn't that a question f

Re: [c++0x] cannot return a constant

2010-11-30 Thread Roman Kononov
2010-11-30 15:13 CST, Gabriel Dos Reis said: >On Tue, Nov 30, 2010 at 3:11 PM, Roman Kononov wrote: >> I exactly want to be unable to change an object during its lifetime >> except when it is moved-and-destroyed. > >isn't that a question for C++ forums? I hoped you knew the answer. :)

Re: [c++0x] cannot return a constant

2010-11-30 Thread Gabriel Dos Reis
On Tue, Nov 30, 2010 at 3:11 PM, Roman Kononov wrote: > 2010-11-30 13:03 CST, James Dennett said: >> >>If you want to be able to change an object during its lifetime, don't >>make it const. > > I exactly want to be unable to change an object during its lifetime > except when it is moved-and-destr

Re: [c++0x] cannot return a constant

2010-11-30 Thread Gabriel Dos Reis
On Tue, Nov 30, 2010 at 3:02 PM, Roman Kononov wrote: >>2) define a copy constructor, explicitly-defaulted if you wish. > > What if the copy constructor is too expensive and I have to use move > constructor? the discussion would be less confused if you identify clearly the language semantics (as

Re: [c++0x] cannot return a constant

2010-11-30 Thread Roman Kononov
2010-11-30 13:03 CST, James Dennett said: > >If you want to be able to change an object during its lifetime, don't >make it const. I exactly want to be unable to change an object during its lifetime except when it is moved-and-destroyed. Thanks

Re: [c++0x] cannot return a constant

2010-11-30 Thread Gabriel Dos Reis
On Tue, Nov 30, 2010 at 2:53 PM, Roman Kononov wrote: > 2010-11-30 20:40 CST, Jonathan Wakely said: >>On 30 November 2010 20:33, Roman Kononov wrote: >>> $ cat test1.cc >>> struct X { >>>  X()=default; >>>  X(X&&)=default; >>>  X(X const&)=delete; >>>  //some very large or non-copyable content >>

Re: [c++0x] cannot return a constant

2010-11-30 Thread James Dennett
On Tue, Nov 30, 2010 at 12:53 PM, Roman Kononov wrote: > 2010-11-30 20:40 CST, Jonathan Wakely said: >>However, that doesn't change the fact you're trying to move from a >>const object, which is obviously wrong. > > Not really, because the 2 const objects are about to be destroyed. The fact that

Re: [c++0x] cannot return a constant

2010-11-30 Thread Roman Kononov
2010-11-30 20:46 CST, Jonathan Wakely said: >On 30 November 2010 20:40, Jonathan Wakely wrote: >>> $ cat test1.cc >>> struct X { >>>  X()=default; >>>  X(X&&)=default; >>>  X(X const&)=delete; >>>  //some very large or non-copyable content >>> }; >>> >>> X test() { >>>  X const x={}; >>>  { >>>  

Re: [c++0x] cannot return a constant

2010-11-30 Thread Roman Kononov
2010-11-30 20:40 CST, Jonathan Wakely said: >On 30 November 2010 20:33, Roman Kononov wrote: >> $ cat test1.cc >> struct X { >>  X()=default; >>  X(X&&)=default; >>  X(X const&)=delete; >>  //some very large or non-copyable content >> }; >> >> X test() { >>  X const x={}; >>  { >>    //a lot of co

Re: [c++0x] cannot return a constant

2010-11-30 Thread Jonathan Wakely
On 30 November 2010 20:40, Jonathan Wakely wrote: > On 30 November 2010 20:33, Roman Kononov wrote: >> This is related to http://gcc.gnu.org/ml/gcc/2010-11/msg00623.html >> >> I write about it again because the following seems too bad: >> >> $ cat test1.cc >> struct X { >>  X()=default; >>  X(X&&)=

Re: [c++0x] cannot return a constant

2010-11-30 Thread Jonathan Wakely
On 30 November 2010 20:33, Roman Kononov wrote: > This is related to http://gcc.gnu.org/ml/gcc/2010-11/msg00623.html > > I write about it again because the following seems too bad: > > $ cat test1.cc > struct X { >  X()=default; >  X(X&&)=default; >  X(X const&)=delete; >  //some very large or non-

[c++0x] cannot return a constant

2010-11-30 Thread Roman Kononov
This is related to http://gcc.gnu.org/ml/gcc/2010-11/msg00623.html I write about it again because the following seems too bad: $ cat test1.cc struct X { X()=default; X(X&&)=default; X(X const&)=delete; //some very large or non-copyable content }; X test() { X const x={}; { //a l