From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24660 invoked by alias); 11 Apr 2002 18:56:02 -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 24642 invoked by uid 71); 11 Apr 2002 18:56:02 -0000 Resent-Date: 11 Apr 2002 18:56:02 -0000 Resent-Message-ID: <20020411185602.24641.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, neil@neilpearce.com Received:(qmail 19727 invoked by uid 61); 11 Apr 2002 18:48:26 -0000 Message-Id:<20020411184826.19726.qmail@sources.redhat.com> Date: Thu, 11 Apr 2002 11:56:00 -0000 From: neil@neilpearce.com Reply-To: neil@neilpearce.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/6262: Incorrect error message reported when applying sizeof() to non-static class member X-SW-Source: 2002-04/txt/msg00622.txt.bz2 List-Id: >Number: 6262 >Category: c++ >Synopsis: Incorrect error message reported when applying sizeof() to non-static class member >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Apr 11 11:56:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: neil@neilpearce.com >Release: unknown-1.0 >Organization: >Environment: SunOS 5.8 Generic_108528-01 sun4u sparc SUNW,Ultra-5_10 Reading specs from /usr/local/gcc3.0.4/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/specs Configured with: ../gcc-3.0.4/configure --exec-prefix=/usr/local/gcc3.0.4 Thread model: posix gcc version 3.0.4 >Description: When using sizeof() on a non-static class member, the error message reported differs depending on the context in which the code appears. GCC 3.0.4 gives an incorrect error message when this is attempted within a constructor >How-To-Repeat: Individually attempt to compile the two sources below, and examine the error messages returned by GCC 3.0.4 ---------- #include struct X { char x[1]; }; struct Y { Y() { std::cout << sizeof(X::x); } } Under GCC 3.0.4, compiliation of the above results in z.cc: In constructor `Y::Y()': z.cc:8: cannot convert a pointer of type `Y' to a pointer of type `X' ---------- #include struct X { char x[1]; }; int main() { std::cout << sizeof(X::x); } Under GCC 3.0.4, compilation of the above results in z.cc:4: member `X::x' is non-static but referenced as a static member z.cc:8: at this point in file >Fix: >Release-Note: >Audit-Trail: >Unformatted: