#include <iostream>
template < std:: size_t N> struct Debug; // No definition
struct obj
{
int oldField;
int newField;
} ;
template <> struct Debug< 4 > { } ; // Definition for "old" sizeof;
template struct Debug< sizeof ( obj) > ; // instanciate Debug, issue error if definition is missing
int main( ) {
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGUgPHN0ZDo6c2l6ZV90IE4+IHN0cnVjdCBEZWJ1ZzsgLy8gTm8gZGVmaW5pdGlvbgoKc3RydWN0IG9iagp7CglpbnQgb2xkRmllbGQ7CQoJaW50IG5ld0ZpZWxkOwkKfTsKCgp0ZW1wbGF0ZSA8PiBzdHJ1Y3QgRGVidWc8ND4ge307IC8vIERlZmluaXRpb24gZm9yICJvbGQiIHNpemVvZjsKCnRlbXBsYXRlIHN0cnVjdCBEZWJ1ZzxzaXplb2Yob2JqKT47IC8vIGluc3RhbmNpYXRlIERlYnVnLCBpc3N1ZSBlcnJvciBpZiBkZWZpbml0aW9uIGlzIG1pc3NpbmcKCmludCBtYWluKCkgewp9
compilation info
prog.cpp:14:17: error: explicit instantiation of ‘struct Debug<8ul>’ before definition of template
template struct Debug<sizeof(obj)>; // instanciate Debug, issue error if definition is missing
^~~~~~~~~~~~~~~~~~
stdout