[patch] Don't compute a "patched" storage class
Rafael EspĂndola
rafael.espindola at gmail.com
Sat Apr 13 14:33:50 PDT 2013
> $ 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
More information about the cfe-commits
mailing list