Re: [cfe-users] Linking problem with implicit instantiation of constructor/destructor

2020-04-20 Thread Richard Smith via cfe-users
In the latest draft, this is [temp.pre]/10: """ A definition of a function template, member function of a class template, variable template, or static data member of a class template shall be reachable from the end of every definition domain (6.3) in which it is implicitly instantiated (13.9.1) un

Re: [cfe-users] Linking problem with implicit instantiation of constructor/destructor

2020-04-19 Thread David Blaikie via cfe-users
Yeah, can't seem to divine the concrete wording here either - perhaps Richard will have a moment to chime in. On Sun, Apr 19, 2020 at 6:10 AM Jaroslav Zeman via cfe-users < cfe-users@lists.llvm.org> wrote: > > > > What happens if you change the order of the .cpp files, putting > > template.cpp fi

Re: [cfe-users] Linking problem with implicit instantiation of constructor/destructor

2020-04-19 Thread Jaroslav Zeman via cfe-users
> > What happens if you change the order of the .cpp files, putting > template.cpp first; is it stil unresolved? > > clang++ -o test template.cpp main.cpp The order doesn't matter. > I don't believe this code is valid according to C++. I believe it would > require an explicit instantiation of t

Re: [cfe-users] Linking problem with implicit instantiation of constructor/destructor

2020-04-17 Thread David Blaikie via cfe-users
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-

Re: [cfe-users] Linking problem with implicit instantiation of constructor/destructor

2020-04-17 Thread krokus via cfe-users
> $ 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

[cfe-users] Linking problem with implicit instantiation of constructor/destructor

2020-04-17 Thread Jaroslav Zeman via cfe-users
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