Package: g++-3.3
Version: 1:3.3.2-0pre4
Severity: normal

The output of the following code, when compiled with g++-3.3 is '2'.  It 
should be '1'.

  #include <iostream>

  struct foo {
    foo()        : v(0), c(0) {}
    int& value() { c++; return v; }
    int count()  { return c; }
    int v, c;
  };


  int main(int argc, char* argv[])
  {
    foo f;
    f.value() = (argc - 1) ? 0 : 1;
    std::cout << f.count() << std::endl;
    return 0;
  }

f.value() is evaluated twice for the ?: operator.


-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux rincewind 2.4.21-5-686-smp #1 SMP Sun Aug 24 16:31:04 EST 2003 
i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages g++-3.3 depends on:
ii  gcc-3.3                    1:3.3.2-0pre4 The GNU C compiler
ii  gcc-3.3-base               1:3.3.2-0pre4 The GNU Compiler Collection (base 
ii  libc6                      2.3.2-7       GNU C Library: Shared libraries an
ii  libstdc++5-3.3-dev         1:3.3.2-0pre4 The GNU Standard C++ Library v3 (d

-- no debconf information



Reply via email to