From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5339 invoked by alias); 26 Sep 2006 19:00:51 -0000 Received: (qmail 5273 invoked by uid 22791); 26 Sep 2006 19:00:50 -0000 X-Spam-Check-By: sourceware.org Received: from bethe.phy.uc.edu (HELO physics.uc.edu) (129.137.4.14) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 26 Sep 2006 19:00:48 +0000 Received: from earth.geop.uc.edu (earth.phy.uc.edu [10.44.11.234]) by physics.uc.edu (8.13.6/8.13.4) with ESMTP id k8QJ0jLP029539; Tue, 26 Sep 2006 15:00:45 -0400 Received: from earth.phy.uc.edu (localhost.localdomain [127.0.0.1]) by earth.geop.uc.edu (8.12.11/8.9.3) with ESMTP id k8QJ0i9Z006104; Tue, 26 Sep 2006 15:00:44 -0400 Received: (from pinskia@localhost) by earth.phy.uc.edu (8.12.11/8.12.11/Submit) id k8QJ0iwL006103; Tue, 26 Sep 2006 15:00:44 -0400 From: Andrew Pinski Message-Id: <200609261900.k8QJ0iwL006103@earth.phy.uc.edu> Subject: Re: [Bug c++/29185] inconsistent warning: deleting array To: gcc-bugzilla@gcc.gnu.org Date: Tue, 26 Sep 2006 19:00:00 -0000 Cc: gcc-bugs@gcc.gnu.org In-Reply-To: <20060926185642.2605.qmail@sourceware.org> X-Mailer: ELM [version 2.5 PL7] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: -2.4 () ALL_TRUSTED X-IsSubscribed: yes Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-09/txt/msg02485.txt.bz2 List-Id: > > > > ------- Comment #5 from sebor at roguewave dot com 2006-09-26 18:56 ------- > You mean something like: if (is_pointer (p)) delete p; > > I suppose that could happen but why should it be any different than other > non-sensical but lexically valid constructs with undefined behavior that > require a diagnostic today? E.g.: > > template > void foo () { > if (0 < N) { > int array [N]; > ... > } > } That is not undefined behavior, just plain invalid. > > Or: > > template > U* bar (T *p) { > if (is_convertible) > return p; > return 0; > } Likewise. This is a different issue. > Isn't template metaprogramming the expected solution to this type of a problem? int a[1]; int *b = a; delete b; is also undefined but it is hard to reject without having flow contrl inside the front-end. -- pinski