Bug 509120 - Alias declarations are not shown in the C/C++ outline view
Summary: Alias declarations are not shown in the C/C++ outline view
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: Next   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-12 23:41 EST by Nathan Ridge CLA
Modified: 2020-09-04 15:18 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2016-12-12 23:41:12 EST
Alias templates do not show up in the C/C++ outline view.

My guess is they don't even get model elements built for them.
Comment 1 Nana Sakisaka CLA 2017-02-15 14:00:47 EST
Code to reproduce:

template<class T>
struct foo
{
  int a;
};

template<class T>
using bar = foo<T>;

bar<void> x;
x. // <--------- No candidates are shown
Comment 2 Nathan Ridge CLA 2017-02-15 15:24:31 EST
(In reply to Nana Sakisaka from comment #1)
> Code to reproduce:
> 
> template<class T>
> struct foo
> {
>   int a;
> };
> 
> template<class T>
> using bar = foo<T>;
> 
> bar<void> x;
> x. // <--------- No candidates are shown

This is a different issue, and is already fixed for 9.2.1 (assuming the "x." line is placed at function scope or in another context where an expression is expected).
Comment 3 Nathan Ridge CLA 2017-02-15 23:03:32 EST
(In reply to Nathan Ridge from comment #2)
> This is a different issue, and is already fixed for 9.2.1

Actually, it works in 9.2.0 (latest released version) as well. What version were you testing with? Or were you trying to perform completion in declaration context?
Comment 4 Nana Sakisaka CLA 2017-02-16 10:05:08 EST
> Or were you trying to perform completion in declaration context?

Whoops, I was doing that. Sorry.
I didn't know Eclipse is incapable of that... I just thought Eclipse's completion feature was some kind of a magic wand.
Comment 5 Nathan Ridge CLA 2017-02-16 14:37:30 EST
(In reply to Nana Sakisaka from comment #4)
> > Or were you trying to perform completion in declaration context?
> 
> Whoops, I was doing that. Sorry.
> I didn't know Eclipse is incapable of that... I just thought Eclipse's
> completion feature was some kind of a magic wand.

Eclipse can perform completion in declaration context if you are writing code that is valid in declaration context. For example:

template<class T>
struct foo
{
  struct nested {};
};

template<class T>
using bar = foo<T>;

bar<void>::/*cursor*/

Here, "nested" is offered as a completion proposal.

However, in your case, there is no valid code that would start with "x." in that context, so no completion proposals are offered.
Comment 6 Nathan Ridge CLA 2018-02-18 14:44:05 EST
Note that this is not specific to template aliases. C++11 alias declarations of any kind are not shown in the outline view, including non-template aliases like:

using T = int;