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@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Reply via email to