public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@physics.uc.edu>
To: gcc-bugzilla@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org
Subject: Re: [Bug c++/29185] inconsistent warning: deleting array
Date: Tue, 26 Sep 2006 19:00:00 -0000	[thread overview]
Message-ID: <200609261900.k8QJ0iwL006103@earth.phy.uc.edu> (raw)
In-Reply-To: <20060926185642.2605.qmail@sourceware.org>

> 
> 
> 
> ------- 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 <int N>
>     void foo () {
>         if (0 < N) {
>             int array [N];
>             ...
>         }
>     }

That is not undefined behavior, just plain invalid.

> 
> Or:
> 
>     template <class T, class U>
>     U* bar (T *p) {
>         if (is_convertible<T*, U*>)
>             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


  reply	other threads:[~2006-09-26 19:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-22 16:36 [Bug c++/29185] New: " sebor at roguewave dot com
2006-09-22 16:43 ` [Bug c++/29185] " pinskia at gcc dot gnu dot org
2006-09-22 16:44 ` pinskia at gcc dot gnu dot org
2006-09-22 16:57 ` sebor at roguewave dot com
2006-09-26 16:31 ` sebor at roguewave dot com
2006-09-26 17:42 ` pinskia at gcc dot gnu dot org
2006-09-26 18:56 ` sebor at roguewave dot com
2006-09-26 19:00   ` Andrew Pinski [this message]
2006-09-26 19:01 ` pinskia at physics dot uc dot edu
2006-09-26 21:43 ` sebor at roguewave dot com
2006-09-28 16:16 ` sebor at roguewave dot com
     [not found] <bug-29185-4@http.gcc.gnu.org/bugzilla/>
2012-05-23  1:31 ` paolo.carlini at oracle dot com
2012-05-23 14:20 ` paolo at gcc dot gnu.org
2012-05-23 14:20 ` paolo at gcc dot gnu.org
2012-05-23 14:35 ` paolo.carlini at oracle dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200609261900.k8QJ0iwL006103@earth.phy.uc.edu \
    --to=pinskia@physics.uc.edu \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-bugzilla@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).