summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr65851.C
blob: 6efe8861a195f6ceb5cf2d26faee8380435bafc2 (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
33
34
35
36
37
// { dg-do compile }
class A {
  virtual unsigned long write(const char *, unsigned long);
};
char *a;
int b;
bool c;
char e[16];
class B {
public:
  void push_range(const char *);
};
class C : A {
  B m_string;

public:
  unsigned long write(const char *p1, unsigned long p2) {
    m_string.push_range(p1 + p2);
  }
};
char *write_signed_decimal_backward(bool) {
  char *d = 0;
  if (b) {
    if (c)
      --a;
    d = a;
  }
  return d;
}

template <typename TextOutputStreamType>
void ostream_write(TextOutputStreamType &p1) {
  char *f = write_signed_decimal_backward(false);
  p1.write(f, e - f);
}

void operator<<(C p1, int) { ostream_write(p1); }