Hello,
I've run into wieird problem when trying to compile and link our programs with
clang++ on linux instead of g++. It occurs, when:
- template class member definitions are separated from the definition of the
class
- no explicit instantiation is done
- member definitions are available only
> $ clang++ -o test main.cpp template.cpp
>
>> /usr/bin/ld: /tmp/main-e2fa2c.o: in function `main':
> main.cpp:(.text+0x2f): undefined reference to `Template::Template()'
> /usr/bin/ld: main.cpp:(.text+0x4d): undefined reference to
> `Template::~Template()'
> /usr/bin/ld: main.cpp:(.text+0x82): und
I don't believe this code is valid according to C++. I believe it would
require an explicit instantiation of the ctor/dtor somewhere to make that
code valid - though I don't have chapter and verse on the spec at hand just
now to back that up.
On Fri, Apr 17, 2020 at 6:54 AM Jaroslav Zeman via cfe-