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 - Wrong error highlight on auto on pair<string, string>
Summary: Wrong error highlight on auto on pair<string, string>
Status: RESOLVED INCOMPLETE
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.2
Hardware: PC Windows 10 x64
: P2 normal (vote)
Assignee: petrk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-02 20:26 UTC by antoniocs
Modified: 2017-10-26 14:27 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Showing error in editor (14.05 KB, image/png)
2017-08-02 20:26 UTC, antoniocs
Details

Note You need to log in before you can comment on or make changes to this bug.
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