// { dg-do compile } template class A { public: class B; typedef typename Config::template D::type TypeHandle; static A *Tagged() { return B::New(B::kTagged); } static TypeHandle Union(TypeHandle); static TypeHandle Representation(TypeHandle, typename Config::Region *); bool Is(); }; template class A::B { friend A; enum { kTaggedPointer = 1 << 31, kTagged = kTaggedPointer }; static A *New(int p1) { return Config::from_bitset(p1); } }; struct C { typedef int Region; template struct D { typedef A *type; }; static A *from_bitset(unsigned); }; A *C::from_bitset(unsigned p1) { return reinterpret_cast *>(p1); } namespace { int *a; void fn1(A *p1) { A::Union(A::Representation(p1, a)); } } void fn2() { A b; A *c = b.Is() ? 0 : A::Tagged(); fn1(c); }