c++.beta - Invalid reference initialisation
- Matthew Wilson (13/13) Aug 24 2003 int main(int /* argc */, char ** /*argv*/)
int main(int /* argc */, char ** /*argv*/) { long l = 2222; short const &s = l; l = 0; printf("%ld, %d\n", l, s); return 0; } Should print "0, 2222", since s should be bound to a temporary. (Std: section 8.5.3) Borland 5.6, CodeWarrior 8.3, Intel 7.0, Visual C++ 6/7.0/7.1, Open Watcom 1.0 all do so. DMC++ and GCC print "0, 0"
Aug 24 2003