Topic: double& rd2 = 2.0; // error?


Author: David Bowser-Chao <davechao@cteq07.pa.msu.edu>
Date: 1996/02/29
Raw View
Looking at the April 1995 working draft proposal,
the fragment:

   double& rd2 = 2.0;

is deemed illegal (non-const references are not initialized from
temporaries) but the GNU g++ 2.7.2 as well as the DEC VMS compiler
(current release, don't remember, as well as the version I'm
field-testing) allow this statement with a mere warning.

This seems like a very basic thing to *fix* - am I missing something
here, is this supposed to be an error, or since April has the committee
changed its mind(s)?
--
David Bowser-Chao               | http://www.pa.msu.edu/people/davechao
High Energy Theoretical Physics | davechao@cteq07.pa.msu.edu
Michigan State University       |
(517) 432-1668                  |
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]





Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: 1996/03/01
Raw View
David Bowser-Chao <davechao@cteq07.pa.msu.edu> writes:

>Looking at the April 1995 working draft proposal,
>the fragment:
>
>   double& rd2 = 2.0;
>
>is deemed illegal (non-const references are not initialized from
>temporaries)

The draft standard does not use the term "illegal".
It uses the term "ill-formed".

>but the GNU g++ 2.7.2 as well as the DEC VMS compiler
>(current release, don't remember, as well as the version I'm
>field-testing) allow this statement with a mere warning.

According to the draft standard, compilers are not required
to issue errors for ill-formed code; they are allowed to issue
mere warnings.

--
Any mail to me between Feb 24th and 27th may have gone to the bit bucket
(#&$^@$!# mail software silently ignored disk full error).  Please resend.
(comp.std.c++ articles were not affected, so no need to resend those.)
Fergus Henderson              WWW: http://www.cs.mu.oz.au/~fjh
fjh@cs.mu.oz.au               PGP: finger fjh@128.250.37.3
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]