[LLVMbugs] [Bug 22793] New: Crash when explicitly instantiating a class template with a protected defaulted dtor, after a use of that dtor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 4 10:42:25 PST 2015


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

            Bug ID: 22793
           Summary: Crash when explicitly instantiating a class template
                    with a protected defaulted dtor, after a use of that
                    dtor
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: compile-fail
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dblaikie at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The most basic repro I can come up with is:

  template <typename>
  struct foo {
  protected:
    ~foo() = default;
    friend void func();
  };

  void func() { foo<int> f; }

  template struct foo<int>;

(including an explicit instantiation declaration before the definition of
'func' doesn't help, FWIW)

Other ways to call ~foo<int> still produce the problem - eg: deriving from
foo<int> and having a user-defined dtor or ctor, even if they're never called.

Making the dtor public instead of protected avoids the crash

Defining the dtor as {} instead of "= default" avoids the crash.

This came up in a Clang self-host (reported as PR22791, among other instances).

-- 
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/20150304/6f3f51d3/attachment.html>


More information about the llvm-bugs mailing list