If I try to compile this code:

class X {};

int main {
  int i = i;
  X x = x;
  X y(y);
  return 0;
}

With:
gcc -Wall main.cpp

There is no error and no warning.


INFOS:

OS:
Ubuntu Hardy

gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr
--enable-targets=all --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)

uname -a
Linux VmWare-Ubuntu 2.6.24-19-generic #1 SMP Fri Jul 11 23:41:49 UTC 2008 i686
GNU/Linux


-- 
           Summary: No error when creating a variable from itself
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: julien dot sagnard at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37854

Reply via email to