Skip to content

Instantly share code, notes, and snippets.

@lnicola
Created June 20, 2014 16:09
Show Gist options
  • Save lnicola/5b57d8134b007f978e91 to your computer and use it in GitHub Desktop.
Save lnicola/5b57d8134b007f978e91 to your computer and use it in GitHub Desktop.
small sample of a hard to parse C++ file
#define PASTE(x,y) x##y
#define COLON :
// this class is: evil
class H;
typedef class H HH;
/*
class NotHere {};
*/
namespace
{
class I { };
class I;
namespace ns1
{
class I { };
PASTE(cl,ass) A : I
{
};
namespace ns2
{
typedef ns1::A I;
struct B PASTE(COL,ON) private I {
typedef B T;
class H *h;
class C : A { };
};
struct B b;
}
}
template<typename T, class U=ns1::ns2::B> struct D : ns1::ns2::I
{
class E : U::T { };
};
class F : public D<F> { };
}
union G { };
class H : D<D<G>, H> { };
int main()
{
ns1::A a;
ns1::ns2::B b;
F f;
G g;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment