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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to