diff options
author | Jason Merrill <jason@redhat.com> | 2019-03-07 10:10:22 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-03-07 10:10:22 -0500 |
commit | d4babd373b9634c6964cad53423470ac8f38addf (patch) | |
tree | 6af919ee11170b35a1dd5ac2f872e4eaeba7038d /gcc/testsuite | |
parent | 5161ffa4f5ae6133167673afc607c07e0be787f8 (diff) | |
download | gcc-d4babd373b9634c6964cad53423470ac8f38addf.zip gcc-d4babd373b9634c6964cad53423470ac8f38addf.tar.gz gcc-d4babd373b9634c6964cad53423470ac8f38addf.tar.bz2 |
PR c++/80916 - spurious "static but not defined" warning.
Nothing can refer to an internal decl with no definition, so we shouldn't
treat such a decl as a possible devirtualization target.
* gimple-fold.c (can_refer_decl_in_current_unit_p): Return false
for an internal symbol with DECL_EXTERNAL.
From-SVN: r269459
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/g++.dg/warn/unused-fn1.C | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/unused-fn1.C b/gcc/testsuite/g++.dg/warn/unused-fn1.C new file mode 100644 index 0000000..aabc01b --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/unused-fn1.C @@ -0,0 +1,16 @@ +// PR c++/80916 +// { dg-options "-Os -Wunused" } + +struct j { + virtual void dispatch(void *) {} +}; +template <typename> +struct i : j { + void dispatch(void *) {} // warning: 'void i< <template-parameter-1-1> >::dispatch(void*) [with <template-parameter-1-1> = {anonymous}::l]' declared 'static' but never defined [-Wunused-function] +}; +namespace { + struct l : i<l> {}; +} +void f(j *k) { + k->dispatch(0); +} |