> $ cat bug.cc
> extern "C" void foo();
>
> $ clang -cc1 -ast-print bug.cc
> extern "C" extern void foo()
>
> The linkage spec decl (only the variant without braces) seems to propagate
> its "extern" keyword down to the inner decl as a *written* storage class. I
> guess this is not really meant.

Good question. In [dcl.link] p7 the standard says:

A declaration directly contained in a linkage-specification is treated
as if it contains the extern speci-
fier (7.1.1) for the purpose of determining the linkage of the
declared name and whether it is a definition.
Such a declaration shall not specify a storage class.

So it seemed convenient to have it there. Douglas, what do you think?
Should I not mark this declaration extren as written or should I just
fix the printing of -ast-dump?

If we do decide that it is not extern as written, we probably need an
extra bit for "one line extern "C" decl".

> Enea.

Cheers,
Rafael
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to