| Summary: | std::shared_ptr and std::unique_ptr not understood | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Wouter <woutertemp> |
| Component: | cdt-indexer | Assignee: | Project Inbox <cdt-indexer-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | malaperle |
| Version: | 7.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
I assume you are using gcc to compile your code. The std::shared_ptr is only available when using the -std=gnu++0x command line option. With this option a bunch of defines is set differently, most notable __GXX_EXPERIMENTAL_CXX0X__ will be defined. To make the indexer pick up the c++0x parts of the headers you need to pass the -std=gnu++0x option for the inspection of the compiler (Project Properties - Build - Scanner Discovery) Be aware that the changes to the tab are not always picked up automatically, I usually have to delete the project from the workspace and reimport it. You can check whether it worked by looking at the Path&Symbols page. I have tested your code with CDT 7.0 and gcc 4.4.0. In this combination it works. Thanks! It now works for me also. Deleting and importing the workspace again was no solution for me though. I had to create a new workspace and import the existing project again (same config: gcc 4.4 and CDT 7). |
Build Identifier: 201006141710 Eclipse doesn't understand std::shared_ptr instances. It doesn't know that foo is a pointer in {std::shared_ptr<Foo> foo(new Foo());}, so it wont allow autocompletion after foo-> nor F3 the 'greet' method in foo->greet(); Note that it does understand the older std::auto_ptr. Basically, std::shared_ptr and std::unique_ptr instances should be treated similar as std::auto_ptr by the indexer. Reproducible: Always Steps to Reproduce: 1. Try to use F3 to jump from foo->greet() to the function definition of 'greet' (see code fragment below). Alternatively you can also try foo->[autocompletion by ctrl-spacebar] class Foo { public: Foo() { printf("constructor Foo\n"); } ~Foo() { printf("destructor Foo\n"); } void greet() { printf("Hello from Foo\n"); } }; #include <memory> void mainproc(void) { std::shared_ptr<Foo> foo(new Foo()); printf("count = %ld\n", foo.use_count()); foo->greet(); }