From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8718 invoked by alias); 22 Apr 2002 08:46:06 -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 8686 invoked by uid 71); 22 Apr 2002 08:46:02 -0000 Resent-Date: 22 Apr 2002 08:46:02 -0000 Resent-Message-ID: <20020422084602.8685.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, wolfgang@dealii.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, wolfgang.bangerth@iwr.uni-heidelberg.de Received:(qmail 5366 invoked by uid 61); 22 Apr 2002 08:40:12 -0000 Message-Id:<20020422084012.5363.qmail@sources.redhat.com> Date: Mon, 22 Apr 2002 01:46:00 -0000 From: wolfgang.bangerth@iwr.uni-heidelberg.de Reply-To: wolfgang.bangerth@iwr.uni-heidelberg.de To: gcc-gnats@gcc.gnu.org Cc: wolfgang@dealii.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify:wolfgang@dealii.org Subject: c++/6402: Qualified reference to variable causes copy X-SW-Source: 2002-04/txt/msg01102.txt.bz2 List-Id: >Number: 6402 >Category: c++ >Synopsis: Qualified reference to variable causes copy >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Apr 22 01:46:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Wolfgang Bangerth >Release: unknown-1.0 >Organization: >Environment: gcc 2.95, 3.1pre, 3.2 mainline >Description: The following snippet doesn't compiler, although I believe it should. The copy operation is caused by me qualifying the name of the member variable "t" with the name of the base class. The original code came from an application where the base class exists twice and a qualification is actually necessary. Regards Wolfgang -----------------------code------------------------ struct T { T(); private: T (const T&); }; struct Base { T t; }; struct Derived : public Base { void f() { const T &t_ref = Base::t; // taking reference, not a copy! }; }; -----------------error message----------------------- x.cc: In method `void Derived::f()': x.cc:4: `T::T(const T &)' is private x.cc:13: within this context >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: