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 151271

Summary: Wrong hyperlink to elements from header included with different macros
Product: cnd Reporter: nnnnnk <nnnnnk>
Component: Code ModelAssignee: nnnnnk <nnnnnk>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: Sun   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description nnnnnk 2008-10-24 13:27:16 UTC
Example:
newfile.h:
#include "newfile1.h"
struct S {
    int i;
    int j;
};

newfile1.h:
#ifdef MACRO1
struct S {
    int i;
};
#endif

newfile.cpp:
#include "newfile.h"

int main() {
    S s; // S links to S from newfile1.h
    s.j; // unresolved j
    return 0;
}

newfile1.cpp:
#define MACRO1
#include "newfile1.h"

newfile1.h is included two times from newfile.cpp (from newfile.h) and newfile1.cpp.
To newfile.cpp it's included without defines.
To newfile1.cpp it's included with MACRO1.
So #ifdef block in newfile1.cpp is active.
And newfile.cpp gets declaration of S from newfile1.cpp instead of newfile.cpp.

Situation is reproducible, but it depends on file parsing sequence.
Comment 1 nnnnnk 2011-01-27 12:47:38 UTC

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