It would expand to an exception at compile time.
R[42, a: 12, c: 0] is invalid because of the constraint that field names
are atoms.
Let's walk through the expansion for a moment. Consider that the [42, a:
12, c: 0] is interpreted as a list using the normal rules, so it's the
list [42, [a: 12, c: 0]], aka [42, [{:a, 12}, {:c, 0}]].
The expansion transforms any element that's not in the keyword list to a
separate keyword list and then concatenates the keyword lists. So [:b,
[{:a, 12}, {:c, 0}]] would become [[{:b, :b}], [{:a, 12}, {:c, 0}]] and
after concatenation [{:b, :b}, {:a, 12}, {:c, 0}] (pretty printed: [b:
b, a: 12, c: 0]).
This transformation would expand [42, [{:a, 12}, {:c, 0}]] to [{42, 42},
{:a, 12}, {:c, 0)]. But now there's a problem, the record field access
code requires a keyword list, which means a list of {atom, any} tuples.
The transformed code is not a keyword list so there would be some kind
of exception raised.
Most likely there would be a bit more intelligence to give more useful
error messages than simply throwing an exception, but the rules are the
same.