http://llvm.org/bugs/show_bug.cgi?id=17537

            Bug ID: 17537
           Summary: Explicit specialization of deleted function template
                    not possible
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

The following code fails to compile with clang r192096:

template <typename T>
void foo() = delete;

template <>
void foo<int>()
{
}

int main()
{
    foo<int>();
}


This results in:

% ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++11 clang.cpp
clang.cpp:5:6: error: redefinition of 'foo'
void foo<int>()
     ^
clang.cpp:5:6: note: previous definition is here
clang.cpp:11:5: error: no matching function for call to 'foo'
    foo<int>();
    ^~~~~~~~
clang.cpp:2:6: note: candidate template ignored: substitution failure [with T =
int]
void foo() = delete;
     ^
2 errors generated.


According to ยง14.7.3p1 [temp.expl.spec], it should be allowed to delete a
function template while explicitly specializing it for a few types. This was
introduced by DR941:

| According to 14.7.3 [temp.expl.spec] paragraph 1, only non-deleted function
| templates may be explicitly specialized. There doesn't appear to be a
compelling
| need for this restriction, however, and it could be useful to forbid use of
| implicitly-instantiated specializations while still allowing use of
explicitly-
| specialized versions.

<http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#941>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to