[cfe-commits] [PATCH] fix for PR7754 - extern "C++" template..

Douglas Gregor dgregor at apple.com
Tue Aug 24 07:15:25 PDT 2010


On Aug 24, 2010, at 4:37 AM, Francois Pichet wrote:

> Here is an updated patch.
> 
> I don't like to duplicate code so I called ParseExternalDeclaration
> with an extra parameter.
> Tell me if you are fine with this since it modify
> ParseExternalDeclaration signature.
> The patch doesn't fail any lit python tests on my Windows.
> 
> But there is something I don't understand in ParseLinkage.
> 
> It seems to me that:
> 1.
> extern "C" declaration;
> 
> is not equivalent to
> 2.
> extern "C" {
>    declaration;
> }
> 
> Based on my knowledge of C++, these 2 codes should be equivalent. Then why is
>    DS.setExternInLinkageSpec(true);
> only called for case 1?

This is C++ [dcl.link]p5, which says that a linkage specification without { } acts like an "extern" specifier.

> I tried to make those 2 cases equivalents by calling
> DS.setExternInLinkageSpec(true); for case 2,
> but this failed quite a lot of python lit test.

Right.

Thanks for the updated patch! I've committed it as r111912.

	- Doug



More information about the cfe-commits mailing list