The "Kind" field for class metadata is an isa pointer and not a member of MetadataKind, and so the switch in swift_dynamicCast was falling out and casting to an uninitialized pointer. Guard Metadata behind some accessor methods that do the right thing and update dynamicCast.
Swift SVN r4525
The interesting thing here is that we need runtime support in
order to generate references to metatypes for classes, mostly
because normal ObjC classes don't have all the information we want
in a metatype (which for now just means the VWT pointer).
We'll need to be able to reverse this mapping when finding a
class pointer to hand off to, say, an Objective-C class method,
of course.
Swift SVN r3424
the metadata kind.
I don't think this is actually a particularly useful thing
to track, especially since a non-generic type can be
generically parented or have a generic superclass or two.
Swift SVN r3182