aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/expr/unary2.C
blob: 4db68375944dcd19bb9036d5f51c419a2fecc03a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// PR c++/18474
// { dg-do compile }
// Unary plus/minus are not lvalues.

int n;

void f(void)
{
  -n = 0;        // { dg-error "3:lvalue" }
  +n = 0;        // { dg-error "3:lvalue" }
}

template <int>
void g(void)
{
  -n = 0;        // { dg-error "lvalue" "" }
  +n = 0;        // { dg-error "lvalue" "" }
}