[PATCH] D41179: [Sema] Diagnose template specializations with C linkage

Faisal Vali via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 27 07:25:03 PST 2017


faisalv added a comment.

In https://reviews.llvm.org/D41179#964522, @miyuki wrote:

> In https://reviews.llvm.org/D41179#957992, @sepavloff wrote:
>
> >   Classes do not have language linkage according to 10.5p1, just as templates, so this code is valid.
> >  
> >   It looks like defining templates inside extern "C" blocks is OK.
>
>
> Currently both Clang and GCC diagnose class templates declared inside an 'extern "C"' block. I'm not sure how to proceed about this.


Given that Clause 17 p6 specifically uses 'shall' to call out templates - i believe the implementation is expected to diagnose this.  10.5p1 (or is there another mention in the standard?) does not explicitly call out 'classes' as not having c language linkage - so implementations can get away not diagnosing this - and perhaps even allow classes to have language linkage on certain implementations?? (at least that's my squinty interpretation)


https://reviews.llvm.org/D41179





More information about the cfe-commits mailing list