> 
> 
> 
> ------- 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 via email to