Re: Quick C++ question for C++ experts :)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/04/15 15:16 +0100, Ian Malone wrote:
Do you mind clarifying? I thought <string> should provide that
http://www.cplusplus.com/reference/string/string/operator+/ or is that
what fno-implicit-templates is turning off?

Of course string provides it, but it's a template, so it needs to be
instantiated. The GCC manual documents -fno-implicit-templates like
so:

 Never emit code for non-inline templates that are instantiated
 implicitly (i.e. by use); only emit code for explicit
 instantiations.

The invalid program in the OP uses operator+(), which would normally
instantiate the function template implicitly. But if you use
-fno-implicit-templates you are promising the compiler you will
provide explicit instantiations. The program above does not provide
them, so it is broken.

 "If you lie to the compiler, it will get its revenge."
 -- Henry Spencer

--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux