+2004-11-14 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ * g++.dg/expr/unary1.C, g++.dg/expr/unary2.C: New tests.
+
2004-11-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/17344
--- /dev/null
+// { dg-do compile }
+// Unary plus (but not unary minus) can be applied to pointer types
+
+void *p;
+
+void f(void)
+{
+ -p; // { dg-error "wrong type argument" }
+ +p;
+}
+
+template <int>
+void g(void)
+{
+ -p; // { dg-error "wrong type argument" }
+ +p;
+}
--- /dev/null
+// { dg-do compile }
+// Unary plus/minus are not lvalues.
+
+// In templates we require an instantiation to emit the diagnostic. This
+// is wrong and it is PR 18474.
+
+int n;
+
+void f(void)
+{
+ -n = 0; // { dg-error "non-lvalue" }
+ +n = 0; // { dg-error "non-lvalue" }
+}
+
+template <int>
+void g(void)
+{
+ -n = 0; // { dg-error "non-lvalue" "" { xfail *-*-* } }
+ +n = 0; // { dg-error "non-lvalue" "" { xfail *-*-* } }
+}