This compiled with my version of clang, I think it could be a gcc bug.
From my reading of the standard, coutis an lvalue type std::ostreamand ofstream("tmp.txt")is an rvalue type std::ofstream.
cv- std::ostream std::ofstream, , r- std::ostream.
.
E1 E2 , : E1 E2, T2 , T1, cv- T2 cv-, cv-, cv- T1. , E1 rvalue T2, ( ). [: . ]
operator<<, , std::ostream, , r. >
basic_ostream<charT,traits>&
basic_ostream<charT,traits>::operator<< (basic_streambuf<charT,traits>* sb);
Edit
, ++ 0x. , rvalue, . ostream , ++ 0x.
: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#446