Custom Post Type title not populating

If you do something like:

$custompost = get_post(get_the_ID());
echo $custompost->post_title;

You’ll find it works. There’s clearly a bug somewhere inside the WordPress core – this is happening to me too for a custom post type. Not sure what triggers it, but the above is a workaround.