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 215662 - c++11 auto and lambda parameter types not recognized
Summary: c++11 auto and lambda parameter types not recognized
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.0
Hardware: Macintosh (x86) Mac OS X
: P2 normal with 2 votes (vote)
Assignee: nnnnnk
URL:
Keywords:
: 216347 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-07-18 05:05 UTC by lurscher
Modified: 2014-03-24 18:51 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot of bug (55.75 KB, image/png)
2014-03-24 11:53 UTC, christianhgross
Details
Screenshot of bug (55.75 KB, image/png)
2014-03-24 11:53 UTC, christianhgross
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lurscher 2012-07-18 05:05:05 UTC
Product Version: NetBeans IDE 7.2 RC1 (Build 201206272359)
Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02
System: Linux version 2.6.35-22-generic running on i386; UTF-8; en_US (nb)


1) lambda parameters inside a lambda give "unable to resolve identifier" syntax highlighting warning 

2) auto parameters give "unable to resolve identifier" syntax hightlighting

the following code demonstrates both problems:

std::for_each( typeDeclarations.begin() , typeDeclarations.end()
            , [&] (const TypeDeclOwnerRef& tyDecl)
            { 
                //both structTypePtr and tyDecl show as unable to resolve identifier
                auto structTypePtr = Compiler::SymbolResolver::resolveOrCreateModuleType( tyDecl.get() );
            } );
Comment 1 Alexander Pepin 2012-07-18 09:40:10 UTC
It's definitely not a P1 but should be a patch candidate.
Comment 2 zachsaw 2012-08-03 07:18:46 UTC
By selecting "C++11" under "Project Properties --> C++ Compiler --> C++ Standard", it forces "-std=c++11" argument on GCC. I'm using GCC 4.5.3, and I manually pass it "-std=c++0x" for most C++11 features.

Why hardcode the argument?
Why not let the user supply their own C++11 argument?
Or better yet, detect GCC version!
I still want to have the code parser properly parse my C++11 source code, but I can't pass "-std=c++11" to the compiler!
We're stuck between a rock and a hard place!
Comment 3 Alexander Simon 2012-08-15 09:30:31 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/6b4b141144ee

The C++11 editor features are activated in the following use cases:

1. The property of a compilation unit "C++ Compiler->C++ Standard" is C++11.
The build action compiles this compilation unit with the flag -std=c++11.
This use case is applicable only if compiler supports c++11 standard.

2. The property of a compilation unit "C++ Compiler->C++ Standard" is <Default>.
The property of the compilation unit "C++ Compiler->Additional Options" is -std=c++0x (or -std=gnu++0x or -std=gnu++11).
The build action compiles this compilation unit with the flag -std=c++0x (or -std=gnu++0x or -std=gnu++11).
This use case is applicable if compiler supports intermediate c++11 standard.
Comment 4 Alexander Simon 2012-08-15 10:41:01 UTC
*** Bug 216347 has been marked as a duplicate of this bug. ***
Comment 5 Quality Engineering 2012-08-16 01:27:21 UTC
Integrated into 'main-golden', will be available in build *201208160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6b4b141144ee
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #215662 c++11 auto and lambda parameter types not recognized
Comment 6 Alexander Pepin 2012-08-30 15:17:48 UTC
The fix in build 20120830 resolves only the problem with -std=c++0x option whereas C++11 issue is still in place.
Comment 7 nnnnnk 2012-08-31 11:40:13 UTC
fixed:
http://hg.netbeans.org/cnd-main/rev/7dadc116b22c
Comment 8 soldatov 2012-08-31 12:09:24 UTC
The fix is verified in build from trunk (Build cnd-build-7928-on-20120831)
Comment 9 soldatov 2012-08-31 13:10:22 UTC
verified
Comment 10 Quality Engineering 2012-09-01 11:10:08 UTC
Integrated into 'releases', will be available in build *201209010822* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/bf0950efa8e6
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #215662 c++11 auto and lambda parameter types not recognized
Comment 11 Tomas Danek 2012-09-03 11:53:21 UTC
comment 9 - verified
Comment 12 Alexander Pepin 2012-09-03 13:47:04 UTC
verified in 7.2 patch 1 build candidate 20120901
Comment 13 Alexander Pepin 2012-09-17 12:11:37 UTC
The testcase should be covered now by C++11 accuracy tests
Comment 14 christianhgross 2014-03-24 11:53:28 UTC
Created attachment 146267 [details]
Screenshot of bug

Screen shot of buy
Comment 15 christianhgross 2014-03-24 11:53:30 UTC
Created attachment 146268 [details]
Screenshot of bug

Screen shot of buy
Comment 16 christianhgross 2014-03-24 11:55:28 UTC
I don't understand how this bug is fixed. As shown in the code when I use the auto variable errors appear indicating that it does not know the type. Even when I use a typecast to the type Netbeans does not know the type.
Comment 17 Alexander Simon 2014-03-24 18:50:16 UTC
(In reply to christianhgross from comment #16)
> I don't understand how this bug is fixed. As shown in the code when I use
> the auto variable errors appear indicating that it does not know the type.
> Even when I use a typecast to the type Netbeans does not know the type.
Please do not reopen this bug because the bug is about "supporting lambda in code model". You complained on concrete bug in code model resolver. Please file another bug with steps to reproduce (or compilable code example).