[llvm-bugs] [Bug 35863] New: explicit specialization of variable template has wrong behavior regarding 'static'

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 8 13:28:16 PST 2018


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

            Bug ID: 35863
           Summary: explicit specialization of variable template has wrong
                    behavior regarding 'static'
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvm-bugs at lists.llvm.org

Case #1:

template<int> static int n;
template<> int n<0>;

Case #2:

template<int> int n;
template<> static int n<0>;

Case #3:

template<int> static int n;
template<> static int n<0>;


For case #1, clang should treat n<0> as being an internal-linkage variable, but
it actually gives it external linkage.

For case #2 and #3, clang should reject ([dcl.stc]p3: A storage-class-specifier
other than thread_local shall not be specified in an explicit specialization).

We appear to get this right for function templates and for explicit
instantiations of variable templates.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180108/3428c1ac/attachment.html>


More information about the llvm-bugs mailing list