What you are seeing is a form of name hiding: a declaration of an variable or function Symbol
will be found in preference to class Symbol
([basic.scope.hiding] §3.3.10/2). In the cases where C++ allows one declaration to hide another in the same scope, there is always an elaborated-type-specifier which still refers to the hidden declaration. They are so named because only a type (class
or enum
) may be hidden in this way; typedefs and templates cannot. The order of declaration is not significant.
In this case, you can use class Symbol
to refer to the class when the variable or function is in scope:
class Symbol global_symbol;