Add context information to duplicate definition warning

Resolves issue #815.