It looks like the behavior has changed since early 2018. On Julia 1.10.5 an error is reported.
julia> g() = (const global y = 1)
ERROR: syntax: `global const` declaration not allowed inside function around REPL[1]:1
Stacktrace:
[1] top-level scope
@ REPL[1]:1
julia>