using Jarod42s "old way", I ended here
template<class T, int X>
struct B {
B(const T&) { cout << "X=" << X << "\n"; }
};
template <int N, class T> B<T, N> make_B(const T& t) { return B<T, N>(t); }
#define MAKE_B(obj, val) make_B<val>(obj)
...
B b2 =MAKE_B("Whatever", 42);