public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: ulrich.lauther@mchp.siemens.de
To: gcc-gnats@gcc.gnu.org
Subject: c++/7674: unjustified syntax error when a class contains a reference AND a pointer to member
Date: Wed, 21 Aug 2002 03:06:00 -0000	[thread overview]
Message-ID: <20020821090045.16920.qmail@sources.redhat.com> (raw)


>Number:         7674
>Category:       c++
>Synopsis:       unjustified syntax error when a class contains a reference AND a pointer to member
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 21 02:06:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Lauther
>Release:        Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs Configured with: /usr/local/src/gcc-3.2/configure --enable-languages=c,c++ Thread model: posix gcc version 3.2
>Organization:
>Environment:
Linux i686, kernel 2.4.5
>Description:
The code attached compiled with g++ bug.C gives:
bug.C: In function `int main()':
bug.C:23: uninitialized const member `components::m_g'


 
>How-To-Repeat:
g++ bug.C

Where bug.C contains:

class hgraph_base {
  public:
  int foo;
};

class Hnode;


class components {

  hgraph_base& m_g;
  int Hnode::* m_node_nr;

public:
  inline components(hgraph_base& pg) : m_g (pg) {
  }
};

int main () {
  
  hgraph_base base;
  
  components bi(base);
  
  return 0;
}
>Fix:
change hgraph_base& into hgraph_base* (and adapt the rest of the program) or comment out the line 
int Hnode::* m_node_nr;
(this is - of course - not really a fix, but might hint at the problem)
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="bug.C"
Content-Disposition: inline; filename="bug.C"

class hgraph_base {
  public:
    int foo;
};

class Hnode;


class components {

  hgraph_base&                m_g;
  int Hnode::*                m_node_nr;

public:
  inline components(hgraph_base& pg) : m_g (pg) {
  }
};

int main () {
  
  hgraph_base base;
  
  components bi(base);
  
  return 0;
}


             reply	other threads:[~2002-08-21  9:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-21  3:06 ulrich.lauther [this message]
2002-09-13 15:15 nathan
2002-10-16 12:42 mmitchel

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=20020821090045.16920.qmail@sources.redhat.com \
    --to=ulrich.lauther@mchp.siemens.de \
    --cc=gcc-gnats@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).