This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] [PR18354] Unary plus as template argument


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]