Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-32518

shared ptr usage incorrect makes creator think a header is not needed.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • Qt Creator 15.0.0
    • C/C++/Obj-C++ Support
    • None
    • Linux/Wayland

    Description

      In a CPP file the 'clangd' based line annotations have one type which shows an include directive to not be needed because it is "not used directly". With the suggestion to remove it.

      This annotation is, however, wrong for the case where the included class declaration is actually wrapped in a smart pointer.

      To avoid confusing descriptions, here is the gcc error when I remove the include for BroadcastTxData.

      SyncSPVAction.cpp:137:50: error: invalid use of incomplete type ‘using std::__shared_ptr_access<BroadcastTxData, __gnu_cxx::_S_atomic, false, false>::element_type = class BroadcastTxData’

      {aka ‘class BroadcastTxData’}

      137 | if (tx && segmentId == tx->privSegment()) {

      A line above that 137 we find:
      auto tx = weakTx.lock();

      It would be nice if creator could avoid showing suggestions to remove includes based on shared pointers using the class.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            tomz Tom Zander
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes