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 243600 - static_cast<int> do not work as casting to int
Summary: static_cast<int> do not work as casting to int
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: petrk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-06 07:12 UTC by VyacheslavVanin
Modified: 2014-04-24 02:13 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 VyacheslavVanin 2014-04-06 07:12:20 UTC
#include <iostream>

enum class myEnum : int
{
    A, B, C,
};

class foo
{
public:
    int field;
};

int main( int argc, char** argv )
{
    foo arr[] = { 100, 200, 400 };

    int a = arr[ 0 ].field; // OK
    int b = arr[ (int) myEnum::A  ].field; // OK

    int c = arr[ static_cast<int>(myEnum::A) ].field; //  field highlighted as unable to resolve 
    int d = arr[ static_cast<int>(0) ].field;         //  field highlighted as unable to resolve

    std::cout << a << " " << b << " " << c << " " << d << std::endl;

    return 0;
}

This is C++11 code, but thing like this "int d = arr[ static_cast<int>(0) ].field;" don't work aslo in c++98.

Ubuntu 13.10 x64.
g++ version 4.8.1
Comment 1 petrk 2014-04-08 09:29:23 UTC
Fixed in http://hg.netbeans.org/cnd-main/rev/e88e7ca51dd3
Comment 2 Quality Engineering 2014-04-09 02:32:34 UTC
Integrated into 'main-silver', will be available in build *201404090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e88e7ca51dd3
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixed #243600 - static_cast<int> do not work as casting to int
Comment 3 Quality Engineering 2014-04-24 02:13:36 UTC
Integrated into 'releases/release80', will be available in build *201404240045* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/ba20fed8369f
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixed #243600 - static_cast<int> do not work as casting to int
(transplanted from e88e7ca51dd3071fed0e258e3c938461f7aa0539)