https://bugs.llvm.org/show_bug.cgi?id=46289

            Bug ID: 46289
           Summary: lack of "templates must have C++ linkage" error
                    message in a linkage specification
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

This code bug.cc

namespace g_namespace{}
extern  "C" {template  <class> using g_namespace;}
extern  "C" {template  <class> void foo(){}}

Clang only gives the "templates must have C++ linkage" error message in line 3,
but missed in line2.

$clang++ -c bug.cc
<source>:2:32: error: cannot template a using declaration
extern  "C" {template  <class> using g_namespace;}
             ~~~~~~~~~~~~~~~~~ ^
<source>:3:14: error: templates must have C++ linkage
extern  "C" {template  <class> void foo(){}}
             ^~~~~~~~~~~~~~~~~
<source>:3:1: note: extern "C" language linkage specification begins here
extern  "C" {template  <class> void foo(){}}
^
2 errors generated.

While in GCC and msvc, they all give two error messages in line 2 and 3 that
indicates "template with C linkage" is wrong.

Reproduced in godbolt : https://godbolt.org/z/B-KzLw

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to