[ create a new paste ] login | about

Project: ncu
Link: http://ncu.codepad.org/ILdNfZrQ    [ raw code | fork ]

GiM - C++, pasted on Jan 7:
template <void (*F)()>
struct SigFoo { static const int x = 0; };

template <class T>
struct RequiredStatics {
	template <class U>
	static int doCheck() {
		return SigFoo< U::foo >::x + SigFoo< U::boo >::x;
	}
	static int dummy;
protected:
	~RequiredStatics() {}
};

/* dunno why, but g++ requires that template<> */
#define _ForceStaticMethodsCheck(D,B) ; \
    template <> \
    int B<D>::dummy = B<D>::doCheck<D>()

struct Foo {
	// try commenting following lines
	static void foo() {};
	static void boo() {};
} _ForceStaticMethodsCheck(Foo, RequiredStatics);

int main(int argc, char* argv[])
{
	return 0;
}


Output:
No errors or program output.


Create a new paste based on this one


Comments: