public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jarrydb at cse dot unsw dot edu dot au" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/43890]  New: invalid uninitialized reference in class
Date: Sun, 25 Apr 2010 23:54:00 -0000	[thread overview]
Message-ID: <bug-43890-18770@http.gcc.gnu.org/bugzilla/> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2175 bytes --]

Compiling with:
g++ uninit_reference.cpp -o uninit_reference.o -std=gnu++0x -c

class Outer 
{
  public:
  Outer()
  : i(*this)
  {
  }

  class Inner 
  {
    public:
    Inner(Outer& o)
    : o(o)
    {
    }

    private:
    Outer& o;
  };

  private:
  Inner i;
};

class A {
  Outer o;
};

int main()
{
  A *a = new A;

  return 0;
}

uninit_reference.cpp: In function ‘int main()’:
uninit_reference.cpp:31:14: error: uninitialized reference member in ‘class A’
using ‘new’
uninit_reference.cpp:18:12: note: ‘Outer::Inner::o’ should be initialized

Configured with: ../gcc-svn/configure --prefix=/home/jarryd/gcc-latest-install
--enable-languages=c,c++ : (reconfigured) ../gcc-svn/configure
--prefix=/home/jarryd/gcc-latest-install --enable-languages=c,c++ --no-create
--no-recursion : (reconfigured) ../gcc-svn/configure
--prefix=/home/jarryd/gcc-latest-install --enable-languages=c,c++ --no-create
--no-recursion : (reconfigured) ../gcc-svn/configure
--prefix=/home/jarryd/gcc-latest-install --enable-languages=c,c++ --no-create
--no-recursion : (reconfigured) ../gcc-svn/configure
--prefix=/home/jarryd/gcc-latest-install --enable-languages=c,c++ --no-create
--no-recursion : (reconfigured) ../gcc-svn/configure
--prefix=/home/jarryd/gcc-latest-install --enable-languages=c,c++ --no-create
--no-recursion : (reconfigured) ../gcc-svn/configure
--prefix=/home/jarryd/gcc-latest-install --enable-languages=c,c++ --no-create
--no-recursion : (reconfigured) ../gcc-svn/configure
--prefix=/home/jarryd/gcc-latest-install --enable-languages=c,c++ --no-create
--no-recursion
Thread model: posix
gcc version 4.6.0 20100425 (experimental) (GCC)


-- 
           Summary: invalid uninitialized reference in class
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jarrydb at cse dot unsw dot edu dot au
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


             reply	other threads:[~2010-04-25 23:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-25 23:54 jarrydb at cse dot unsw dot edu dot au [this message]
2010-04-26  9:31 ` [Bug c++/43890] [4.6 Regression] " redi at gcc dot gnu dot org
2010-04-26  9:58 ` fabien dot chene at gmail dot com
2010-04-26 11:03 ` redi at gcc dot gnu dot org
2010-04-26 17:58 ` pinskia at gcc dot gnu dot org
2010-04-28 19:14 ` fabien dot chene at gmail dot com
2010-04-29 21:57 ` jarrydb at cse dot unsw dot edu dot au
2010-04-30  4:23 ` jason at gcc dot gnu dot org
2010-05-11 16:41 ` fabien dot chene at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-43890-18770@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).