I’m trying to use an instant of a custom class as a template parameter.
class X {
public:
X() {};
};
template <class Foo, Foo foo>
struct Bar {
};
const X x;
Bar<X, x> foo;
The compiler states that x cannot appear in a constant expression. Why that? There is everything given to construct that object at compile time.
You can’t do it. Standard 14.1 says: