[cfe-dev] Hello

Argiris Kirtzidis akyrtzi at gmail.com
Sun Oct 5 16:37:02 PDT 2008


Sebastian Redl wrote:
> Argiris Kirtzidis wrote:
>> Hmm, the standard says at  3.4.3p1: "During the lookup for a name 
>> preceding the '::' scope resolution operator, object, function, and 
>> enumerator names are ignored. If the name found is not a class-name 
>> or namespace-name, the program is ill-formed".
>> It seems to me that '::' binds to left-hand identifiers and if the 
>> identifier is not a namespace or class, we can consider it an error. 
>> I can't find anything about resorting to the global scope when the 
>> identifier exists and it's not a class or namespace.
>> For comparison, both MSVC and Comeau report something like "error: 
>> name followed by '::' must be a class or namespace".
> The contradiction between 3.4.3 and 5.1 was part of the defect report.

Ah ok, I guess C++03 wasn't clear about the '::' binding.

About the example:

typedef int foo;
namespace abc { foo bar(); }
foo::abc::bar()
{
 // ...
}

Are you suggesting that we should have identical behavior as gcc (not 
emitting an error) ?
This doesn't seem so important, particularly considering that it is 
going to be explicitly stated that an error is necessary.
We already have minor incompatibilities with gcc, like the scoping of 
the 'condition' declarations in selection/iteration statements and some 
cases of declaration/expression ambiguity resolution.


-Argiris



More information about the cfe-dev mailing list