[LLVMbugs] [Bug 22763] New: Explicit template instantiations do not instantiate explicitly defaulted special members

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 2 15:28:39 PST 2015


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

            Bug ID: 22763
           Summary: Explicit template instantiations do not instantiate
                    explicitly defaulted special members
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          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

$ cat foo.h
struct base { 
  virtual ~base() {};
};

template <typename T>
struct foo : base {
  foo() {};
  foo(const foo&) 
#ifdef DEFAULT
      = default;
#else
      {}
#endif
};

__extension__ extern template struct foo<int>;
$ cat ext.cpp
#include "foo.h"

int main() {
  foo<int> f;
  foo<int> g = f;
}
$ cat ext2.cpp
#include "foo.h"
template struct foo<int>;
$ clang++-tot ext.cpp -std=c++11 ext2.cpp 
$ clang++-tot ext.cpp -std=c++11 ext2.cpp -DDEFAULT
/tmp/ext-f809ea.o:ext.cpp:function main: error: undefined reference to
'foo<int>::foo(foo<int> const&)'
clang-3.5: error: linker command failed with exit code 1 (use -v to see
invocation)
$

-- 
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/20150302/a309ffc9/attachment.html>


More information about the llvm-bugs mailing list