Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr68064.C

raw
1 // { dg-do compile }
2
3 template <class Config> class A {
4 public:
5 class B;
6 typedef typename Config::template D<A>::type TypeHandle;
7 static A *Tagged() { return B::New(B::kTagged); }
8 static TypeHandle Union(TypeHandle);
9 static TypeHandle Representation(TypeHandle, typename Config::Region *);
10 bool Is();
11 };
12
13 template <class Config> class A<Config>::B {
14 friend A;
15 enum { kTaggedPointer = 1 << 31, kTagged = kTaggedPointer };
16 static A *New(int p1) { return Config::from_bitset(p1); }
17 };
18
19 struct C {
20 typedef int Region;
21 template <class> struct D { typedef A<C> *type; };
22 static A<C> *from_bitset(unsigned);
23 };
24 A<C> *C::from_bitset(unsigned p1) { return reinterpret_cast<A<C> *>(p1); }
25
26 namespace {
27 int *a;
28 void fn1(A<C> *p1) { A<C>::Union(A<C>::Representation(p1, a)); }
29 }
30
31 void fn2() {
32 A<C> b;
33 A<C> *c = b.Is() ? 0 : A<C>::Tagged();
34 fn1(c);
35 }