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 268582 - Ide underlines std::vector as error
Summary: Ide underlines std::vector as error
Status: RESOLVED WORKSFORME
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.1
Hardware: All All
: P2 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-19 09:25 UTC by Vladimir Kvashin
Modified: 2016-11-30 12:54 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The attachment "netbeans_cpp_std_vector_bug.png" shows netbeans highlighting an error which is not an error. (9.90 KB, image/png)
2016-10-19 09:39 UTC, Vladimir Kvashin
Details
The attachment "netbeans_cpp_std_vector_no_bug_using_std.png" shows how adding namespace magically fixes everything (9.25 KB, image/png)
2016-10-19 09:39 UTC, Vladimir Kvashin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Kvashin 2016-10-19 09:25:58 UTC
This is related with issue 268419. The specific problem issue 268419 was filed for has been fixed. But there is another similar problem. Since root cause is different, I'm filing a separate bug instead of reopening old one.

User complains that in the following code if you change vector<int> a; to std::vector<int> a; then IDE underlines it red

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char** argv) {    
    vector<int> a; //if you add std:: netbeans will highlight it as an error

    for (int i = 0; i < 10; i++) {
        a.push_back(i);
    }
    
    for (int i : a) {
        std::cout << i << " ";
    }
    
    std::cout << std::endl;
    
    return 0;
}
Comment 1 Vladimir Kvashin 2016-10-19 09:29:49 UTC
Product Version: NetBeans IDE Dev (Build 201610140002)
Java: 1.8.0_101; Java HotSpot(TM) 64-Bit Server VM 25.101-b13
Runtime: Java(TM) SE Runtime Environment 1.8.0_101-b13
System: Windows 10 version 10.0 running on amd64; Cp1252; en_GB (nb)

I can now use std::string but I can't use std::vector (and std::string works even if I don't include the <string> header)

I have attached a screenshot 2 screenshots.

The attachment "std::vector error" shows netbeans highlighting an error which is not an error.

The  attachment "vector now works with using namespace std;" shows how adding namespace magically fixes everything. 

Both versions compile just fine by doing:

g++ -Wall -g -std=c++14 -o vec_test vec_test.cpp
Comment 2 Vladimir Kvashin 2016-10-19 09:39:11 UTC
Created attachment 162551 [details]
The attachment "netbeans_cpp_std_vector_bug.png" shows netbeans highlighting an error which is not an error.
Comment 3 Vladimir Kvashin 2016-10-19 09:39:48 UTC
Created attachment 162552 [details]
The attachment "netbeans_cpp_std_vector_no_bug_using_std.png" shows how adding namespace magically fixes everything
Comment 4 Vladimir Kvashin 2016-10-19 09:46:41 UTC
Unfortunately I wasn't able to reproduce this neither with my current build nor in dev version taken from 
http://bits.netbeans.org/dev/nightly/2016-10-14_00-02-33

I used ubuntu 16.10 with gcc 6.2.0 
I used full remote project
Comment 5 Vladimir Voskresensky 2016-11-29 18:12:39 UTC
Alexander, please, help to investigate
Comment 6 Alexander Simon 2016-11-30 12:54:47 UTC
Vladimir, I cant fix unreproducible bug.
Please provide steps to reproduce.