Issue 134289
Summary [clang] explicit template instantiation generates invalid symbol
Labels clang
Assignees
Reporter vasama
    ```
template<typename T>
void hello(T* CONST) {}

template void hello<int>(int*);
```

```
C:\Users\vasama\sandbox λ cat test.cpp
template<typename T>
void hello(T* CONST) {}

template void hello<int>(int*);
C:\Users\vasama\sandbox λ clang --version
clang version 20.1.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
C:\Users\vasama\sandbox λ clang++ test.cpp -c -o test-0.obj -DCONST=
C:\Users\vasama\sandbox λ clang++ test.cpp -c -o test-1.obj -DCONST=const
C:\Users\vasama\sandbox λ dumpbin /SYMBOLS test-0.obj | grep hello

008 00000000 SECT4  notype ()    External     | ??$hello@H@@YAXPEAH@Z (void __cdecl hello<int>(int *))

C:\Users\vasama\sandbox λ dumpbin /SYMBOLS test-1.obj | grep hello

008 00000000 SECT4  notype ()    External     | ??$hello@H@@YAXQEAH@Z (void __cdecl hello<int>(int * const))
```

When targeting the MS ABI, if the function is declared with `const` parameter, the symbol is mangled with `const` parameter, despite `const` on parameters not being part of the function type.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to