OSDN Git Service

* gcc.target/i386/pr37843-4.c: Allow for leading underscores on
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / pr42704.C
1 /* { dg-do compile } */
2
3 typedef int PRInt32;
4 class nsTreeRows {
5     class Subtree { };
6     enum { kMaxDepth = 32 };
7     struct Link {
8         Subtree* mParent;
9         PRInt32 mChildIndex;
10         Link&         operator=(const Link& aLink) {
11             mParent = aLink.mParent;
12             mChildIndex = aLink.mChildIndex;
13         }
14     };
15     class iterator {
16         PRInt32 mTop;
17         PRInt32 mRowIndex;
18         Link mLink[kMaxDepth];
19     public:
20         iterator() : mTop(-1), mRowIndex(-1) { }
21         iterator& operator=(const iterator& aIterator);
22     };
23     Subtree*     EnsureSubtreeFor(Subtree* aParent, PRInt32 aChildIndex);
24     Subtree*     GetSubtreeFor(const Subtree* aParent,
25 PRInt32 aChildIndex,                   PRInt32* aSubtreeSize = 0);
26     void     InvalidateCachedRow() {
27         mLastRow = iterator();
28     }
29     iterator mLastRow;
30 };
31 nsTreeRows::Subtree* nsTreeRows::EnsureSubtreeFor(Subtree* aParent,
32                      PRInt32 aChildIndex) {
33     Subtree* subtree = GetSubtreeFor(aParent, aChildIndex);
34     if (! subtree) {
35         InvalidateCachedRow();
36     }
37 }
38 nsTreeRows::iterator& nsTreeRows::iterator::operator=(const iterator&
39 aIterator) {
40     mTop = aIterator.mTop;
41     for (PRInt32 i = mTop;
42          i >= 0;
43          --i)         mLink[i] = aIterator.mLink[i];
44 }