Assertion in Function.cpp when linking modules

Hi everybody

I am having a hard time figuring out the following problem:
I am porting a library that uses LLVM 2.5 from Linux to Windows (LLVM compiled with cmake/MSVC, llvm-g++ pre-built binaries).
Compilation works fine, but at runtime, I encounter the following assertion:

Assertion failed: FunctionType::isValidReturnType(getReturnType()) && !isa<OpaqueType>(getReturnType
()) && "invalid return type", file .\Function.cpp, line 164

This happens somewhere in "LinkInModule" when trying to link two loaded .bc-files (generated by llvm-g++).

The weird point:
The assertion fires because the comparison RetTy == Type::VoidTy in isValidReturnType() fails although the TypeID is 0, the printed type is "void" and the function actually *does* return void.
This does not make any sense to me :(.

Any ideas on how to proceed?