[llvm-bugs] [Bug 38380] New: clang incorrectly diagnoses use of deleted member of current instantiation in template

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 31 00:50:32 PDT 2018


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

            Bug ID: 38380
           Summary: clang incorrectly diagnoses use of deleted member of
                    current instantiation in template
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rjmccall at apple.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Consider the following code:

  template <class T> struct A {
    static void foo() = delete;
    static void bar() { foo(); }
  };
  template <> void A<int>::foo() {}

  int main() { A<int>::bar(); }

Clang currently diagnoses this like so:

  harza:sw:swift$ clang++ -fsyntax-only /tmp/red.cpp 
  /tmp/red.cpp:3:23: error: attempt to use a deleted function
    static void bar() { foo(); }
                      ^
  /tmp/red.cpp:2:15: note: 'foo' has been explicitly marked deleted here
    static void foo() = delete;
                ^
  1 error generated.

And Clang is in good company when it does this, because every single other
compiler I tested gives essentially the same diagnostic.

However!  I'm not sure this is actually ill-formed, because as far as I can
tell it is totally valid to have a non-deleted explicit specialization of a
member function of a class template.

-- 
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/20180731/4ff2ad96/attachment.html>


More information about the llvm-bugs mailing list