[cfe-dev] Doubt about Decl::getDeclContext()
Eli Friedman
eli.friedman at gmail.com
Wed May 26 12:49:48 PDT 2010
On Wed, May 26, 2010 at 4:55 AM, Abramo Bagnara
<abramo.bagnara at gmail.com> wrote:
>
> I've just noted that unexpectedly (at least for me) getDeclContext()
> applied to an extern VarDecl returns the FunctionDecl instead of the
> TranslationUnitDecl:
>
> int f() {
> extern int a;
> }
>
> Is this expected or a symptom of a bug?
Expected; even though "a" is a global in the sense of linkage, it
isn't actually part of the global scope. It is only visible within
the function "f".
-Eli
More information about the cfe-dev
mailing list