summaryrefslogtreecommitdiffstats
path: root/gnulib-local/tests/test-moo-assign.c
blob: 079668b77d067833f57e8d5e8c5bef1a94d37cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Test assignments.
   Errors are signalled in C++ mode only, not by a C compiler.  */
#include "test-moo-sub2.h"

void foo ()
{
  root_t a;
  sub1_t b;
  sub2_t c;

  /* Test initializations.  */
  root_t a1 = a;
  root_t a2 = b;
  root_t a3 = c;
  sub1_t b1 = a;	/* ERROR */
  sub1_t b2 = b;
  sub1_t b3 = c;
  sub2_t c1 = a;	/* ERROR */
  sub2_t c2 = b;	/* ERROR */
  sub2_t c3 = c;

  /* Test assignments.  */
  a = a1;
  a = b1;
  a = c1;
  b = a2;	/* ERROR */
  b = b2;
  b = c2;
  c = a3;	/* ERROR */
  c = b3;	/* ERROR */
  c = c3;
}