Bug 478689 - C++ Semantic analysis gets confused by class inheritance
Summary: C++ Semantic analysis gets confused by class inheritance
Status: REPORTED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (other bugs)
Version First Reported In: 5.12.230801
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-18 15:35 UTC by Mattia Basaglia
Modified: 2023-12-19 07:41 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Screenshot showing kdevelop properly detects base classes but still marks them as an error (354.61 KB, image/png)
2023-12-18 15:35 UTC, Mattia Basaglia
Details
Successful GlaxnimateWindow parsing (145.90 KB, image/png)
2023-12-19 07:41 UTC, Igor Kushnir
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mattia Basaglia 2023-12-18 15:35:23 UTC
Created attachment 164276 [details]
Screenshot showing kdevelop properly detects base classes but still marks them as an error

SUMMARY

It seems KDevelop starts giving type errors for conversions between a pointer to a derived class to its base class / ancestors.

It correctly finds the methods and highlights them / give the correct info on hover but marks it as an error.

This happens both with function calls and access to members declared in base classes using `->`.

It seems to be caused by multiple inheritance because commenting out one of the base classes seems to fix the issue.

The same codebase worked fine a couple kdevelop versions ago.

STEPS TO REPRODUCE
1. For me it happens for this class: https://invent.kde.org/graphics/glaxnimate/-/blob/master/src/gui/widgets/dialogs/glaxnimate_window.hpp#L40
2. Open the project mentioned above with kdevelop
3. Open https://invent.kde.org/graphics/glaxnimate/-/blob/master/src/gui/widgets/dialogs/gw_impl_ui.cpp

OBSERVED RESULT
Bunch of correct code marked as an error

EXPECTED RESULT
It shouldn't mark it

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 23.10
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.5.0-14-generic (64-bit)
Graphics Platform: X11
Processors: 8 × AMD FX(tm)-8320 Eight-Core Processor
Memory: 31.4 GiB of RAM
Graphics Processor: AMD Radeon RX 470 Graphics
Manufacturer: NOVATECH LTD
Product Name: PC-X006665
System Version: V1.0
Comment 1 Igor Kushnir 2023-12-19 07:41:54 UTC
Created attachment 164284 [details]
Successful GlaxnimateWindow parsing

Works for me in KDevelop 5.13 (almost latest master). Attached a screenshot. Try exiting KDevelop, clearing the session's cache in ~/.cache/kdevduchain/kdevelop-{<session-ID>}, then starting KDevelop again.