Re: value not set via reference

2015-01-30 Thread Jonathan Wakely
On 30 January 2015 at 07:23, Conrad S wrote: > On 30 January 2015 at 16:58, James Dennett wrote: >> It's hardly just a loophole: C++ doesn't specify the order of evaluation, >> so the code is wrong (i.e., non-portable, as you've found). >> >> Arguably this is a design problem with IOStreams, given

Re: value not set via reference

2015-01-29 Thread Conrad S
On 30 January 2015 at 16:58, James Dennett wrote: > It's hardly just a loophole: C++ doesn't specify the order of evaluation, > so the code is wrong (i.e., non-portable, as you've found). > > Arguably this is a design problem with IOStreams, given how > tempting it can be to write code that assumes

Re: value not set via reference

2015-01-29 Thread James Dennett
On Thu, Jan 29, 2015 at 10:38 PM, Conrad S wrote: > > Which compiler is correct here - gcc or clang? Both compilers are correct. > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64870 > > Consider the following code: > > #include > > struct blah { > inline double setval(unsigned int& x) const >

value not set via reference

2015-01-29 Thread Conrad S
Which compiler is correct here - gcc or clang? https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64870 Consider the following code: #include struct blah { inline double setval(unsigned int& x) const { x = 123; return 456.0; } }; int main(int argc, char** argv) { blah blah_ins