Q:

Is ref const X the same as const ref X in D?

Quite recently it has been discussed here how strange const is in D in terms of placement (right or left of function name etc.).
Now I wonder, if ref const X the same as const ref X in function parameter?
both versions compile in my test project but I'd like a confirmation

A:

The order only matters if you need to use parens.
void foo(ref const int* x) {...}

is the same as
void foo(const ref int* x) {...}

However, if you want const(int)*, then you're going to have to do
void foo(ref const(int)* x) {...}

because then there's no way to put the ref to the right of the const with the parens there.
The only case that I'm aware of where the order of attributes matters on a parameter, other genres of variables, or a return type when it's not syntax issue is with auto ref, because auto ref is essentially an attribute made up of two words rather than being two separate attributes both affecting the symbol. In all other cases, the order shouldn't matter. And the order doesn't matter on function attributes either. It's just the whole left-hand side vs right-hand side of the function signature bit that's an ordering issue.

