1 2 3 4 5 | template<class T, const char* p> int X() { }; const char p[] = "Vivisectionist"; int m() {X<int,p>();} |
dGVtcGxhdGU8Y2xhc3MgVCwgY29uc3QgY2hhciogcD4gaW50IFgoKSB7Cn07CmNvbnN0IGNoYXIgcFtdID0gIlZpdmlzZWN0aW9uaXN0IjsKaW50IG0oKSB7WDxpbnQscD4oKTt9CiA=
prog.cpp: In function ‘int X()’: prog.cpp:2: warning: no return statement in function returning non-void prog.cpp: In function ‘int m()’: prog.cpp:4: error: ‘p’ cannot appear in a constant-expression prog.cpp:4: error: no matching function for call to ‘X()’
-
result: Compilation error (maybe you wish to see an example for C++ 4.7.2)


