E2397 Template argument cannot have static or local linkage (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

Only integral constant expressions, and the address of global variables with external linkage, may be used as template arguments. For example:

template<char *x>
class foo;
const char *p = "Hello";
extern char *q;
foo<p> x;// OK: "p" is visible to the outside
foo<q> y;// OK: "q" is also globally visible
foo<"Hello"> z;// error: string literal has static linkage