[Bug c++/107906] linkage of template not taken into account

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 29 08:57:09 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107906

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.1.2
            Summary|Function template           |linkage of template not
                   |specialization given weak   |taken into account
                   |rather than local symbol    |

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>specializations 
That is not a specialization, that is an instantiation.

>So it's somehow a mistake of function templates.

It is not function templates which is causing the issue.  Rather than it is
template taking another template type which is causing issues.

E.g.
```
namespace {
  template<class>
  struct Y{};
}

template<template<class> class Q> 
struct f{
  f(){__builtin_printf("Hello.\n");}
};
f<Y> z;
```
f<Y>'s ctor is emitted as a weak symbol.


More information about the Gcc-bugs mailing list