This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] [PR18354] Unary plus as template argument
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Giovanni Bajo <giovannibajo at libero dot it>
- Cc: gcc-patches at gcc dot gnu dot org, Mark Mitchell <mark at codesourcery dot com>
- Date: Sun, 14 Nov 2004 02:33:04 +0000 (UTC)
- Subject: Re: [C++ PATCH] [PR18354] Unary plus as template argument
- References: <02f201c4c9eb$15cf9640$46b92997@bagio>
On Sun, 14 Nov 2004, Giovanni Bajo wrote:
> So, the simplest solution is to unify the handling by removing code
> duplication. After all, I can't see why they should be handled differently.
> This also removes one occurrence of NON_LVALUE_EXPR, which is scheduled to be
> removed sometime in the future.
Does your patch preserve the properties that (a) C++, unlike C, permits
the operand of unary plus, but not unary minus, to have pointer type, (b)
the result of unary plus is not an lvalue? That is,
void *p;
void f(void) { +p; }
is valid C++ (but not valid C), while
int n;
void f(void) { +n = 0; }
is invalid as both C and C++.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)