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

Francois Pichet pichet2000 at gmail.com
Tue Aug 24 04:37:23 PDT 2010


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?

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.


On Mon, Aug 23, 2010 at 10:44 AM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Aug 19, 2010, at 3:35 AM, Francois Pichet wrote:
>
>> Hi
>>
>> This is a patch to fix PR7754. clang couldn't compile this:
>> extern "C++" template <class T> int pr7754(T param);
>
> This definitely looks like the right approach, but there are a number of other kinds of declarations that should also be handled this way. For example,
>
>  namespace N { int value; }
>  extern "C++" using N::value;
>
> I think this just means duplicating the keyword checks from ParseExternalDeclaration in ParseLinkage, although perhaps there is a better way.
>
>        - Doug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Extern_linkage2.patch
Type: application/octet-stream
Size: 2690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100824/6cc66b50/attachment.obj>


More information about the cfe-commits mailing list