From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12272 invoked by alias); 7 May 2003 21:09:43 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12253 invoked by uid 48); 7 May 2003 21:09:42 -0000 Date: Wed, 07 May 2003 21:09:00 -0000 Message-ID: <20030507210942.12252.qmail@sources.redhat.com> To: bwood@emc.com, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org From: bangerth@dealii.org Reply-To: bangerth@dealii.org, bwood@emc.com, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: c++/10668: [diagnostic] assigning address of non-static member variable to pointer X-SW-Source: 2003-05/txt/msg00503.txt.bz2 List-Id: Old Synopsis: nested class looks for member variable rather than object New Synopsis: [diagnostic] assigning address of non-static member variable to pointer State-Changed-From-To: open->analyzed State-Changed-By: bangerth State-Changed-When: Wed May 7 21:09:42 2003 State-Changed-Why: The compiler is correct. However, the message is confusing: it taking the address of c1::i, which is of type int (c1::*). This cannot be assigned to a variable of type int*. (NB: why does it take the address of a member variable? To take the address of a member function, it must always be fully specialized, i.e. &X::foo. &foo is not sufficient. Why is it here?). Present 3.4 gives the following message: g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc x.cc: In constructor `c1::c2::c2()': x.cc:10: error: `c1::i' is not a member of `c1::c2' This is not nearly as helpful as icc's message: g/x> icc -c x.cc -Xc -ansi x.cc(10): error: a nonstatic member reference must be relative to a specific object c2() { y = &i; }; W. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10668