https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111923
--- Comment #13 from Stas Sergeev <stsp at users dot sourceforge.net> --- Just for the record, Richard Smith pointed the correct syntax for my problem, which I would never ever find myself, and likely no one else in the world, too: #include <cstddef> template <auto O> struct B { public: static constexpr int off = O(); }; #define OFFSET_OF(c, m) \ []<typename T = c>() constexpr ->int { return offsetof(T, m); } struct A { char a; B<OFFSET_OF(A, b)> b; }; Works like a magic. The only addition to the initial example, is the "typename T = c" part, but this is what no one would ever discover.