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 242729 - Some c++11 features not recognized by code assistance engine
Summary: Some c++11 features not recognized by code assistance engine
Status: RESOLVED INCOMPLETE
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Completion (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: petrk
URL:
Keywords:
: 243506 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-03-10 09:16 UTC by tport
Modified: 2017-11-15 18:44 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot showing the occuring errors (14.82 KB, image/png)
2014-03-10 09:16 UTC, tport
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tport 2014-03-10 09:16:52 UTC
Created attachment 145893 [details]
screenshot showing the occuring errors

Some c++11 features are treated as errors by netbeans (see attached screenshot). So far I detected the following:

Use of std::array yields 'unable to resolve identifier' error.
Use of std::stof and std::stoi yield 'unable to resolve identifier' errors.

The project compiles and runs fine (by using the hammer button) but netbeans shows error markers in the editor. However, many c++11 keywords are recognized, I have no problems with nullptr, override for example.

c++11 standard is set for code assistance in the project properties. I use NB 7.4 but also tried it with 8 RC, the issue also exists in NB 8 RC. I use gcc 4.8.1 but I don't think this matters, since it compiles fine.
Comment 1 petrk 2014-03-10 10:18:24 UTC
Simple test case:

// Code model is broken here
    struct array
    {
      void
      swap(array& __other)
      noexcept(noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>())))
      { std::swap_ranges(begin(), end(), __other.begin()); }

      // Iterators.
      iterator
      begin() noexcept
      { return iterator(data()); }
    };
Comment 2 tport 2014-03-11 13:26:51 UTC
I don't know if such information is useful, but I just observed that calling std::move() is also not recognized.
Comment 3 petrk 2014-03-11 17:22:28 UTC
Fixed in http://hg.netbeans.org/cnd-main/rev/eb97345becf7 (comment in the commit is wrong)
Comment 4 tport 2014-03-14 13:02:11 UTC
Hey you are so incredibly fast!

I just got a nightly build and tested it. Now all these errors are gone. Thank you a lot!
Comment 5 petrk 2014-03-14 18:41:00 UTC
You are welcome ;)
Comment 6 tport 2014-03-22 14:02:17 UTC
I don't know if I should reopen or file a new bug report.

Even though this problem seems to be solved for the case when creating a new "C++ Application" using the wizard (and leaving everything to default), I still encounter the issue when importing my own project (which uses cmake).

After importing, the IDE says that everyting is ok, it compiles and runs fine and code assistance works. There are no red error markers and I can ctl+click to keywords like 'std::shared_ptr' and 'std::array' to hyperlink to the definitions.

However, after restarting the IDE, all error markers (as described in the initial post) are back and ctl+click doesn't work any more :( I can still compile and run the project. Am I doing something wrong? Is this maybe because of cmake?
Comment 7 petrk 2014-04-04 11:51:33 UTC
Sorry, haven't look on emails from netbeans for a while. First of all, you should check if this still is valid after deleting cache directory. If the problem won't gone, please, post another bug. (Obviously, it is not bug with grammar or semantic resolving)
Comment 8 petrk 2014-04-04 11:52:56 UTC
*** Bug 243506 has been marked as a duplicate of this bug. ***
Comment 9 wlfbck 2014-11-30 16:02:20 UTC
@petrk: The std::shared_ptr bug is still a problem for me with Netbeans 8.0.2 under Ubuntu. cache has been deleted. The project is a Cmake project (https://github.com/SebastianNiemann/OnlineOptimisation/tree/master).
Comment 10 petrk 2015-05-18 10:51:16 UTC
(In reply to wlfbck from comment #9)
> @petrk: The std::shared_ptr bug is still a problem for me with Netbeans
> 8.0.2 under Ubuntu. cache has been deleted. The project is a Cmake project
> (https://github.com/SebastianNiemann/OnlineOptimisation/tree/master).

I downloaded NetBeans 8.0.2 right now and do not see any problems with std::shared_ptr. Please, provide more details on your issue. I'm using Ubuntu too, gcc version is 4.8.1
Comment 11 porwolikt 2015-09-16 06:57:32 UTC
I had the same issue now (Ubuntu 15.10, Netbeans 8.0.2 for C/C++) and problem is in constant __cplusplus=199711L. It's value must be at least 201103L and you can change it in Tools -> Options -> C/C++ -> Code Assistance -> C++ -> Macro Definitions.
Comment 12 grayrattus 2017-11-15 18:44:28 UTC
(In reply to porwolikt from comment #11)
> I had the same issue now (Ubuntu 15.10, Netbeans 8.0.2 for C/C++) and
> problem is in constant __cplusplus=199711L. It's value must be at least
> 201103L and you can change it in Tools -> Options -> C/C++ -> Code
> Assistance -> C++ -> Macro Definitions.

I know it's like 2 years since this comment but this bug still apeared in 2017. Anyway your solution worked on Version: NetBeans IDE 8.2 (Build 201705191307)
Thanks!