Issue 139101
Summary weak-vtables warning emitted when compiling with -xhip
Labels new issue
Assignees
Reporter kurtmcmillan
    test.h:
```
struct A {
        virtual ~A();
};
```
test.cpp
```
#include "test.h"

A::~A() {}
```
```
$ docker run -it silkeh/clang:dev /bin/bash
root@844bdf4ea665:/test# clang -v
Debian clang version 21.0.0 (++20250429112531+d68b446933aa-1~exp1~20250429112651.1418)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-21/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64

root@844bdf4ea665:/test# clang++ -Wweak-vtables -c test.cpp

root@844bdf4ea665:/test# clang++ -Wweak-vtables -xhip -nogpulib -nogpuinc -c test.cpp
In file included from test.cpp:1:
./test.h:1:8: warning: 'A' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Wweak-vtables]
    1 | struct A {
 |        ^
1 warning generated when compiling for gfx906.
```
```
$ docker run -it --rm -v /home/kurtmcmillan/test:/test silkeh/clang:20 /bin/bash
root@11ad7fe426a5:/# clang++ -v
Debian clang version 20.1.4 (++20250426011826+182e8b7f8a71-1~exp1~20250426011849.108)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-20/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64

root@11ad7fe426a5:/test# clang++ -Wweak-vtables -c test.cpp

root@11ad7fe426a5:/test# clang++ -Wweak-vtables -xhip -nogpulib -nogpuinc -c test.cpp
In file included from test.cpp:1:
./test.h:1:8: warning: 'A' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Wweak-vtables]
    1 | struct A {
 |        ^
1 warning generated when compiling for gfx906.
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to