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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And as I've already said, the quality of the particular
-Waggressive-loop-optimizations warning is a separate issue, and should be
dealt with in a separate PR.

PR 58876 (mentioned in comment 0 as the reason for creating this bug) shows a
proper instantiation trace when -Wsystem-headers is used:

In file included from /home/jwakely/gcc/9/include/c++/9.0.1/memory:80,
                 from up.cc:1:
/home/jwakely/gcc/9/include/c++/9.0.1/bits/unique_ptr.h: In instantiation of
'void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = A]':
/home/jwakely/gcc/9/include/c++/9.0.1/bits/unique_ptr.h:289:17:   required from
'std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = A; _Dp =
std::default_delete<A>]'
up.cc:12:30:   required from here
/home/jwakely/gcc/9/include/c++/9.0.1/bits/unique_ptr.h:81:2: warning: deleting
object of abstract class type 'A' which has non-virtual destructor will cause
undefined behavior [-Wdelete-non-virtual-dtor]
   81 |  delete __ptr;
      |  ^~~~~~

That shows the up.cc:12 location from the user code that triggers the warning.

But I can't make libstdc++ show that warning because of this bug with the
diagnostic pragmas.

Improving the warning in comment 4 is irrelevant to this bug.

Reply via email to