November 30

Whats the current state of the art of compile time counters

my old code:

//dmd -mixin=mix -run count.d

import std;
template counter(){
	template access(int i){
		enum access=mixin("__LINE__");
	template get_(int i,int sentinel){
		//pragma(msg,i," ",sentinel);
		static if(access!(i)>sentinel){
			enum get_=i;
		} else {
			enum get_=get_!(i+1,sentinel);
	template get(int i=__LINE__){
		enum setty=mixin("__LINE__");
		alias get=get_!(0,setty);
void main(){

I'm picking dependencies for a build environment where I want to be productive for at least a few years and picking which compiler bug to depend on probably deserves some consideration

Are there other options and what pros and cons do you see with other compiler bugs?