[LLVMbugs] [Bug 12937] New: Rejects-valid when deleting an explicit template specialization

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 24 12:06:11 PDT 2012


             Bug #: 12937
           Summary: Rejects-valid when deleting an explicit template
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dblaikie at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Given this:

  template<typename> void func();
  template<> void func<int>() = delete;

Clang produces this error: 

  spec.cpp:2:31: error: deleted definition must be first declaration
  template<> void func<int>() = delete;
  spec.cpp:2:17: note: previous declaration is here
  template<> void func<int>() = delete;

It seems Clang produces an implicit specialization of the declaration from the
primary template and then make the user's explicit specialization as a
redeclaration of the implicit one. Thus, it looks like it's a redeclaration and
triggers the error.

This code is explicitly valid based on 8.4.3 [dcl.fct.def.delete] p4:

"A deleted definition of a function shall be the first declaration of the
function or, for an explicit specialization of a function template, the first
declaration of that specialization."

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list