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

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
3dldf 2.0.3+dfsg-6./scanprse.web:9720:13: error: out-of-line definition of 'pickup_command' does not match any declaration in namespace 'Scan_Parse' Log

1 errors