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 243506 - Red underlining member functions of std::array elements
Summary: Red underlining member functions of std::array elements
Status: RESOLVED DUPLICATE of bug 242729
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.0
Hardware: PC Linux
: P1 normal (vote)
Assignee: issues@cnd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-03 08:12 UTC by xecu91
Modified: 2014-04-04 11:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xecu91 2014-04-03 08:12:20 UTC
For example, let's create an empty C++ project and edit main.cpp so it looks like this:

#include <mutex>
#include <array>
#include <iostream>

int main(int argc, char** argv)
{
    std::array<std::mutex, 2>;
    am
    am[1].lock();
    am[1].unlock();
    std::cout << "Lock & unlock succeed!\n";
    return 0;
}

And change C++ standard to C++11 in project options, and add a compilation & linking flag --std=gnu++11.
IDE will underline lock & unlock operators with red line, and will note autocomplete them, however, std::array provides operator[] which returns a reference to array element.
This code will successfully compile and run.
There was no such issue in NetBeans 7.4, everything worked fine.
Comment 1 xecu91 2014-04-03 08:17:07 UTC
Update, correcting typing errors.

For example, let's create an empty C++ project and edit main.cpp so it looks like this:

#include <mutex>
#include <array>
#include <iostream>

int main(int argc, char** argv)
{
    std::array<std::mutex, 2> am;
    am[1].lock();
    am[1].unlock();
    std::cout << "Lock & unlock succeed!\n";
    return 0;
}

And change C++ standard to C++11 in project options, and add a compilation & linking flag --std=gnu++11.
IDE will underline lock & unlock operators with red line, and will not autocomplete them, however, std::array provides operator[] which returns a reference to array element.
This code will successfully compile and run.
There was no such issue in NetBeans 7.4, everything worked fine.
Comment 2 Alexander Simon 2014-04-04 06:49:41 UTC
(In reply to xecu91 from comment #1)
> And change C++ standard to C++11 in project options, and add a compilation &
> linking flag --std=gnu++11.
Are you sure that your compiler works right with both flags?
I.e.
#g++ -c -g -std=c++11 -std=gnu++11 ...
compile file without error?

You should either use "C++ standard to C++11" or "compilation & linking flag --std=gnu++11".
Comment 3 xecu91 2014-04-04 06:58:19 UTC
(In reply to Alexander Simon from comment #2)
> (In reply to xecu91 from comment #1)
> > And change C++ standard to C++11 in project options, and add a compilation &
> > linking flag --std=gnu++11.
> Are you sure that your compiler works right with both flags?
> I.e.
> #g++ -c -g -std=c++11 -std=gnu++11 ...
> compile file without error?
> 
> You should either use "C++ standard to C++11" or "compilation & linking flag
> --std=gnu++11".

Yes. I just checked it. It compiles and runs correctly. If select just "C++ standart C++11" in project proerties, it won't build.

OFFTOP: Actually, I thought keys -std=C++0x, -std=c++11 and -std=gnu++11 do the same thing, at least using gcc.
Comment 4 Alexander Simon 2014-04-04 07:25:02 UTC
(In reply to xecu91 from comment #3)
> (In reply to Alexander Simon from comment #2)
> > (In reply to xecu91 from comment #1)
> > > And change C++ standard to C++11 in project options, and add a compilation &
> > > linking flag --std=gnu++11.
> > Are you sure that your compiler works right with both flags?
> > I.e.
> > #g++ -c -g -std=c++11 -std=gnu++11 ...
> > compile file without error?
> > 
> > You should either use "C++ standard to C++11" or "compilation & linking flag
> > --std=gnu++11".
> 
> Yes. I just checked it. It compiles and runs correctly. If select just "C++
> standart C++11" in project proerties, it won't build.
> 
> OFFTOP: Actually, I thought keys -std=C++0x, -std=c++11 and -std=gnu++11 do
> the same thing, at least using gcc.
Please, attach build log of simple application where you use both flags.
Comment 5 xecu91 2014-04-04 07:30:24 UTC
(In reply to Alexander Simon from comment #4)
> (In reply to xecu91 from comment #3)
> > (In reply to Alexander Simon from comment #2)
> > > (In reply to xecu91 from comment #1)
> > > > And change C++ standard to C++11 in project options, and add a compilation &
> > > > linking flag --std=gnu++11.
> > > Are you sure that your compiler works right with both flags?
> > > I.e.
> > > #g++ -c -g -std=c++11 -std=gnu++11 ...
> > > compile file without error?
> > > 
> > > You should either use "C++ standard to C++11" or "compilation & linking flag
> > > --std=gnu++11".
> > 
> > Yes. I just checked it. It compiles and runs correctly. If select just "C++
> > standart C++11" in project proerties, it won't build.
> > 
> > OFFTOP: Actually, I thought keys -std=C++0x, -std=c++11 and -std=gnu++11 do
> > the same thing, at least using gcc.
> Please, attach build log of simple application where you use both flags.

I did not use both flags. I selected C++ standard in project options -> C++ compiler -> C++11. And lower, additional parameters -> -std=gnu++11. Build log:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/atk/NetBeansProjects/CppApplication_1'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cppapplication_1
make[2]: Entering directory `/home/atk/NetBeansProjects/CppApplication_1'
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/main.o.d"
g++ -std=gnu++11   -c -g -std=c++11 -MMD -MP -MF "build/Debug/GNU-Linux-x86/main.o.d" -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -std=gnu++11    -o dist/Debug/GNU-Linux-x86/cppapplication_1 build/Debug/GNU-Linux-x86/main.o 
make[2]: Leaving directory `/home/atk/NetBeansProjects/CppApplication_1'
make[1]: Leaving directory `/home/atk/NetBeansProjects/CppApplication_1'

СОБРАТЬ SUCCESSFUL (общее время: 475ms)
Comment 6 xecu91 2014-04-04 07:31:40 UTC
(In reply to Alexander Simon from comment #4)
> (In reply to xecu91 from comment #3)
> > (In reply to Alexander Simon from comment #2)
> > > (In reply to xecu91 from comment #1)
> > > > And change C++ standard to C++11 in project options, and add a compilation &
> > > > linking flag --std=gnu++11.
> > > Are you sure that your compiler works right with both flags?
> > > I.e.
> > > #g++ -c -g -std=c++11 -std=gnu++11 ...
> > > compile file without error?
> > > 
> > > You should either use "C++ standard to C++11" or "compilation & linking flag
> > > --std=gnu++11".
> > 
> > Yes. I just checked it. It compiles and runs correctly. If select just "C++
> > standart C++11" in project proerties, it won't build.
> > 
> > OFFTOP: Actually, I thought keys -std=C++0x, -std=c++11 and -std=gnu++11 do
> > the same thing, at least using gcc.
> Please, attach build log of simple application where you use both flags.

upd: actually, additional parameters is not necessary to build. But, issue still remains.
Comment 7 petrk 2014-04-04 11:52:56 UTC
For me it works in dev version

*** This bug has been marked as a duplicate of bug 242729 ***