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 257822 - Unresolved identifier in designated initializer of compound literal
Summary: Unresolved identifier in designated initializer of compound literal
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: petrk
URL:
Keywords:
: 255876 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-02-02 18:31 UTC by creinke
Modified: 2016-08-26 01:50 UTC (History)
1 user (show)

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 creinke 2016-02-02 18:31:32 UTC
In a C99 project, an initializer field identifier in a compound literal seems to be resolved against the type of the variable being initialized rather than the type of the compound literal.

struct Foo
{
    int foo1;
};

struct Foo *baz1 = &(struct Foo)
{
    .foo1 = 0,  // .foo1 is resolved
};

void *baz2 = &(struct Foo)
{
    .foo1 = 0,  // .foo1 is NOT resolved
};

struct Bar
{
    int foo1;
};

struct Bar *baz3 = (void *)&(struct Foo)
{
    .foo1 = 0,  // .foo1 is resolved
};

void *baz4 = (void *)&(struct Foo)
{
    .foo1 = 0,  // .foo1 is NOT resolved
};
Comment 1 petrk 2016-07-20 11:20:06 UTC
Fixed in http://hg.netbeans.org/cnd-main/rev/bc712d97b7dd
Comment 2 Quality Engineering 2016-07-21 01:51:54 UTC
Integrated into 'main-silver', will be available in build *201607210002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/bc712d97b7dd
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixed #257822 - Unresolved identifier in designated initializer of compound literal
Comment 3 petrk 2016-08-21 12:53:16 UTC
*** Bug 255876 has been marked as a duplicate of this bug. ***
Comment 4 dpirch 2016-08-21 16:47:31 UTC
This is fixed as of nightly build 201608210002. However, a similar issue is still present if compound literals are used in statements instead of declarations: bug #267663
Comment 5 Quality Engineering 2016-08-26 01:50:03 UTC
Integrated into 'main-silver', will be available in build *201608260002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/263dda368cc1
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Additional fix for #257822 - Unresolved identifier in designated initializer of compound literal
-- fixed case when there is no whitespace between rparen and lbrace in compund literal