Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364236

Summary: Code analysis of virtual base classes is incomplete
Product: [Tools] CDT Reporter: Michael N. Lipp <mnl>
Component: cdt-codanAssignee: CDT Codan Inbox <cdt-codan-inbox>
Status: CLOSED DUPLICATE QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug, ckluss, malaperle, mnl, yevshif
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
The code that reproduces the problem none

Description Michael N. Lipp CLA 2011-11-20 08:34:51 EST
Build Identifier: 20110615-0604

Omniorb (CORBA implemplementation) generates (correct) code that is considered incorrect by code analysis. I have stripped down the code to the basic problem, but I'm afraid it still needs a bit of explanation.

We have class CItf that defines a pure virtual function "tbi()". The implementation of the interface (includes more methods in omniorb) is split and provided by two classes CImplPart1 and CImplPart2 (of course I have omitted all the methods that are implemented by those classes in omniorb; the point in omniorb is that CImplPart1 is common to all eventually derived implementations, while CImplPart2 varies, i.e. may be replaced by different classes for supplying the particular methods).

Eventually the "fixed" part CImplPart1 and the "varying" part (represented here by CImplPart2) are combined again in a class "CCombinedImpl" that can be used to instanciate objects.

CImplPart2 contributes the implementation of the pure virtual "tbi()", but it does this using a private definition of the method. This is a bit strange but formally OK.

However, code analysis does not accept this implementation as satisfying the requirement for an implementation of the pure virtual method "tbi()" in CItf and puts an error marker at the declaration of an object of type CCombinedImpl in Test.cpp.

The code compiles nevertheless without even a warning. I've added "invokeTbi" simply to show that it also works as expected.


Reproducible: Always

Steps to Reproduce:
1. Unpack
2. Look at error marker
Comment 1 Michael N. Lipp CLA 2011-11-20 08:35:40 EST
Created attachment 207277 [details]
The code that reproduces the problem
Comment 2 Christof Kluß CLA 2013-06-22 06:21:55 EDT
seems to be the same bug as https://bugs.eclipse.org/bugs/show_bug.cgi?id=351612
Comment 3 Marc-André Laperle CLA 2013-06-27 09:47:49 EDT

*** This bug has been marked as a duplicate of bug 351612 ***