Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Identifier 'X' clashes with an introduced type

The OMG IDL specification includes complex scoping rules based not only on where types are defined, but also on where they are used. Specifically, the first component (identifier) of a qualified type name is introduced into the scope where it is used, preventing the use of any identifier with the same name in that scope. Fully-qualified names, which start with ::, are considered to have an empty first component, and thus result in no type introduction.

The following example illustrates the basic type introduction rules.

struct Name
	{
	    string first, last;
	};

	struct Address
	{
		string street, city, state, country;
	};

	module M
	{
		typedef long Age;
	};

	struct Person
	{
		Name   name;    // invalid IDL: 'name' clashes with 'Name'
		string address; // OK: 'Address' not introduced in this scope
		M::Age age;     // OK: only 'M', not 'Age', is introduced
	};

In the Person structure above, the use of the Name type introduces it into the scope of Person, which prevents the member from being called name. The second member, address, is fine because the Address type is not defined within the scope of Person and has not been introduced. The reference to M::Age only causes the first component, M, to be introduced into the scope of Person, thus the age member is also without error.

Clashes with introduced types can generally be resolved by changing the qualification to avoid the type introduction. For instance, if in the above example the type of the name member of the Person structure were written ::Name, no type introduction would occur, which would avoid the name clash.