One of the solution can be template Volatile(T) { alias Volatile = __gdc_volatile__(T); } And each compiler defines this template in a way which suits it best, because stock DMD frontend can't accept arbitrary keywords, so you need to hide them behind some common syntax.