Bug 370334 - Implicitly declared class considered as subclass
Summary: Implicitly declared class considered as subclass
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (show other bugs)
Version: git master
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-09 10:04 UTC by KiloAlphaIndia
Modified: 2019-04-22 13:49 UTC (History)
1 user (show)

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


Attachments
patch for kdevelop/plugins/clang/duchain/builder.cpp (1.87 KB, patch)
2019-04-22 13:49 UTC, KiloAlphaIndia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description KiloAlphaIndia 2016-10-09 10:04:39 UTC
class Test {
public:
    class Test2* data; // hover over Test2 shows class as Test::Test2 (unresolved forward-declaration) 
};

class Test2 // hover over Test2 shows class as Test2
{
public:
    int integer;
};

int main(int,char**)
{
    Test t;
    t.data = new Test2; // hover over Test2 shows class as Test::Test2 (unresolved forward-declaration) 
    return t.data->integer;
}


Reproducible: Always

Steps to Reproduce:
1. Paste code into editor
2. hover over Test2 in class definition of Test
3. hover over Test2 in main function


Actual Results:  
Step 2: class is shown as Test::Test2 (unresolved forward-declaration) 
Step 3: class is shown as Test::Test2 (unresolved forward-declaration)


Expected Results:  
Step 2: class is shown as Test2 or ::Test2  (unresolved forward-declaration)
Step 3: class is shown as Test2 or ::Test2 and can be resolved
Comment 1 KiloAlphaIndia 2017-01-02 14:07:20 UTC
I have now looked this up in the (draft) C++ Standard N3797.
The section 3.4.4 paragraph 3 gives a very obvious example:
struct Node {
struct Node* Next;
// OK: Refers to
Node
at global scope
struct Data* Data;
// OK: Declares type
Data
// at global scope and member
Data
};
Comment 2 KiloAlphaIndia 2017-01-02 14:10:47 UTC
Ups. Sorry failed to format it correctly

I have now looked this up in the (draft) C++ Standard N3797.
The section 3.4.4 paragraph 3 gives a very obvious example:

struct Node {
    struct Node* Next; // OK: Refers to Node at global scope
    struct Data* Data; // OK: Declares type Data
                       // at global scope and member Data
};

This is the same for the keyword class.

Can anybody mark this as CONFIMED please.
Comment 3 KiloAlphaIndia 2019-04-22 13:49:53 UTC
Created attachment 119557 [details]
patch for kdevelop/plugins/clang/duchain/builder.cpp

fix inline class declaration context