Check for identical package name and prefix in imported package.

From-SVN: r168494
This commit is contained in:
Ian Lance Taylor 2011-01-04 23:29:49 +00:00
parent 3ebb5ca6cc
commit 5667638c69

View File

@ -332,6 +332,12 @@ Gogo::import_package(const std::string& filename,
Package* package = imp.import(this, local_name, is_local_name_exported);
if (package != NULL)
{
if (package->name() == this->package_name()
&& package->unique_prefix() == this->unique_prefix())
error_at(location,
("imported package uses same package name and prefix "
"as package being compiled (see -fgo-prefix option)"));
this->imports_.insert(std::make_pair(filename, package));
package->set_is_imported();
}