[Bug c++/105645] Template specializations are not hidden with fvisibility=hidden

kndevl at outlook dot com gcc-bugzilla@gcc.gnu.org
Thu May 19 06:10:15 GMT 2022


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

--- Comment #2 from Karthik Nishanth <kndevl at outlook dot com> ---
Additional details:

When I add a template definition for `Test::encode()` before specialization, it
hides the specialized symbol. The snippet below produces `00000000000010e9 t
int Test::encode<(Test::Encoding)0>(int)`.

```
namespace Test {
enum class Encoding { A,
    B };

template <Encoding enc>
int encode(int);

template <Encoding enc>
int encode(int x) { return x - 1; }

template <>
int encode<Encoding::A>(int x)
{
    return x + 1;
}

int f() { return 42; }
}
```


More information about the Gcc-bugs mailing list