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.

Bug 271223

Summary: Wrong error highlight on auto on pair<string, string>
Product: cnd Reporter: antoniocs <antoniocs>
Component: Code ModelAssignee: petrk
Status: RESOLVED INCOMPLETE    
Severity: normal    
Priority: P2    
Version: 8.2   
Hardware: PC   
OS: Windows 10 x64   
Issue Type: DEFECT Exception Reporter:
Attachments: Showing error in editor

Description antoniocs 2017-08-02 20:26:29 UTC
Created attachment 164890 [details]
Showing error in editor

Hello,

I have this bit of code:

#include <string>
#include <utility>

std::pair<std::string, std::string> testeFunc() {
    return std::make_pair(std::string("test1"),std::string("test1"));
}

int main(int argc, char** argv) {
    auto x = testeFunc().first.empty();
    
    return 0;
}

With this everything works fine but if I change the testeFunc() return type to auto, like this:

#include <string>
#include <utility>

auto testeFunc() {
    return std::make_pair(std::string("test1"),std::string("test1"));
}

int main(int argc, char** argv) {
    auto x = testeFunc().first.empty();
    
    return 0;
}

The method "empty()" is now highlighted in red with the message: "Unable to resolve identifier empty."

I am compiling this as c++14 so everything compiles fine, it's netbeans that can't understand the auto.

Is there anyway to make netbeans understand this?
Comment 1 petrk 2017-10-26 14:26:09 UTC
Hi!

Can you, please, check it in the latest development version? Cannot reproduce the issue. BTW, I use g++ 6.2.0.

Thanks,
Petr
Comment 2 petrk 2017-10-26 14:27:15 UTC
So, please, provide more info about your environment