This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
No code completion in Dev 201403030001/201403210001 for auto variable which source is (?)dynamic(?) struct MyClass{ void foo(){} }; int main() { auto varCorrect0 = MyClass(); auto varCorrect1 = &varCorrect0; auto varIncorrect0 = new MyClass(); auto varIncorrect1 = std::make_shared(new MyClass()); varCorrect0.foo(); //OK varCorrect1->foo(); //Note: even if varCorrect1 is a ptr it works just fine varIncorrect0->foo(); //Unable to resolve identifier foo varIncorrect1->foo(); //Unable to resolve identifier foo std::vector<MyClass> vec(3); for (auto varInteresting0 : vec) { varInteresting0 ->foo(); //In 201403030001 were incorrect but got fixed until 201403210001 } return 0; } The bug is maybe a variant(!) of #214111
I got this problem too, was about to create a new bug. My test code is: #include <iostream> #include <memory> class Test { public: void doSomething(void) { std::cout << "Hi, there" << std::endl; } }; int main(int argc, char **argv) { auto i = 1; auto x = new int(2); i++; auto ip = std::shared_ptr<int>(x); *ip = *ip + 4; std::cout << "i: " << i << "ip: " << *ip << std::endl; Test *t = new Test(); t->doSomething(); auto tp = std::shared_ptr<Test>(t); tp->doSomething(); /* No autocompletion in this case */ std::shared_ptr<Test> tp2 = std::shared_ptr<Teste>(t); tp2->doSomething(); } I'll attach some screenshoots too.
Created attachment 146392 [details] no auto completion
Created attachment 146393 [details] auto completion ok for shared_ptr without auto
Fixed in http://hg.netbeans.org/cnd-main/rev/bde743ff9c12 Btw, the first test case is not compilable - std::make_shared should be explicitely instantiated with parameter MyClass. ============================================================================== #include <memory> #include <vector> struct MyClass{ void foo(){} }; int main() { auto varCorrect0 = MyClass(); auto varCorrect1 = &varCorrect0; auto varIncorrect0 = new MyClass(); auto varIncorrect1 = std::make_shared<MyClass>(MyClass()); varCorrect0.foo(); varCorrect1->foo(); varIncorrect0->foo(); varIncorrect1->foo(); std::vector<MyClass> vec(3); for (auto varInteresting0 : vec) { varInteresting0.foo(); } return 0; } ===============================================================================
Integrated into 'main-silver', will be available in build *201404180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/bde743ff9c12 User: Petr Kudryavtsev <petrk@netbeans.org> Log: Fixed #243171 - No code completion for auto variable
verified in trunk build 201404220001
Integrated into 'releases/release80', will be available in build *201404240045* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/736c3c0dbb67 User: Petr Kudryavtsev <petrk@netbeans.org> Log: Fixed #243171 - No code completion for auto variable (transplanted from bde743ff9c12fe1d5a536d6ad50764ea93420773)
verified in NetBeans 8.0 patch1 build