From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8471 invoked by alias); 9 Oct 2002 19:06: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 8450 invoked by uid 71); 9 Oct 2002 19:06:02 -0000 Resent-Date: 9 Oct 2002 19:06:02 -0000 Resent-Message-ID: <20021009190602.8449.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, charles@kde.org Received: (qmail 8362 invoked by uid 61); 9 Oct 2002 19:05:02 -0000 Message-Id: <20021009190502.8361.qmail@sources.redhat.com> Date: Wed, 09 Oct 2002 12:06:00 -0000 From: charles@kde.org Reply-To: charles@kde.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/8176: C++ const**, doesn't implictly cast X-SW-Source: 2002-10/txt/msg00334.txt.bz2 List-Id: >Number: 8176 >Category: c++ >Synopsis: C++ const**, doesn't implictly cast >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Oct 09 12:06:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: charles@kde.org >Release: gcc 2.96 through gcc 3.2, probably 2.95 too >Organization: >Environment: Linux >Description: class Bleh { }; void foo(const Bleh **) { } int main(int, char **) { Bleh *bleh; foo(&bleh); // broken Bleh **bar; foo(bar); // broken foo(const_cast(bar)); // works const Bleh **works; foo(works); // works } This should work, as can be casted to implicitly Error: bug.cpp: In function `int main (int, char **)': bug.cpp:13: `bleh' undeclared (first use this function) bug.cpp:13: (Each undeclared identifier is reported only once for each function it appears in.) bug.cpp:16: cannot convert `Bleh **' to `const Bleh **' for argument `1' to `foo (const Bleh **)' >How-To-Repeat: Put the compiler in a situation in which it should cast a pointer to a pointer to an object to a pointer to a pointer to a const object (Type** -> const Type**) >Fix: Create a more generic code thing to always implicitly cast a something to a const something. >Release-Note: >Audit-Trail: >Unformatted: