The following reply was made to PR c++/8176; it has been noted by GNATS. From: Andreas Schwab To: charles@kde.org Cc: gcc-gnats@gcc.gnu.org Subject: Re: c++/8176: C++ const**, doesn't implictly cast Date: Wed, 09 Oct 2002 21:42:03 +0200 charles@kde.org writes: |> 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 No, you can't. class Bleh { int what; }; const Bleh const_bleh; void foo(const Bleh **bleh) { *bleh = &const_bleh; } int main() { Bleh *bleh; foo(&bleh); // assume this is valid (*bleh)->what = 1; // modifying const_bleh! } Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."