that's interesting, maybe even a bug.
Code1 calls void Mat::push_back(const Mat& elems),
Code2 calls void Mat::push_back(const _Tp& elem) , which is clearly broken. it seems to get the MatExpr returned from Mat::zeros() wrong ( because it's non-const ? )
well, this one works, too ( but it's clearly not , what you wanted )
Mat matrix( 0, 3, CV_32F );
matrix.push_back( Mat( Mat::zeros( 2, 3, CV_32F) ) );
matrix.push_back( Mat( Mat::ones( 2, 3, CV_32F ) ) );
cerr << matrix << endl;
maybe make an issue here