"Definition differs from the declaration in the return type " build failure(s) — clang 2.9

For some reasons, clang refuses the following syntax while g++ accepts it:
#include <streambuf>

struct S { typedef int fd_type; };

template  class A : public std::basic_streambuf, public S
{ fd_type& foo(); };

template  typename A::fd_type& A::foo()
{ return NULL; }
PackageVersionSupposed error messageFull log Bug report
eq10q 1.2-2pstream.h:1736:28: error: out-of-line definition of 'redi::basic_pstreambuf::wpipe' differ from the declaration in the return type Log
pdf2djvu 0.7.8-1pstream.h:1736:28: error: out-of-line definition of 'redi::basic_pstreambuf::wpipe' differ from the declaration in the return type Log
pyside-mobility 0.2.2-1qgraphicsvideoitem_wrapper.cpp:121:47: error: out-of-line definition of 'metaObject' does not match any declaration in 'QGraphicsVideoItemWrapper' Log

3 errors