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 144363

Summary: typename in for-loop leads to unresolved identifier error
Product: cnd Reporter: Alexey Vladykin <alexey_vladykin>
Component: Code CompletionAssignee: Alexey Vladykin <alexey_vladykin>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Alexey Vladykin 2008-08-19 11:06:47 UTC
namespace ns { typedef int III; }

int main(int argc, char** argv) {
    for (typename ns::III i = 0; i < argc; ++i) { // "i" is unresolved
        puts("%s", argv[i]); // "i" is unresolved
    }
    return 0;
}
Comment 1 Alexey Vladykin 2008-08-20 12:04:08 UTC
One more typename-related issue found in Loki:

return associations_.insert(
    typename IdToProductMap::value_type(id, creator)).second != 0; // value_type is not resolved

Without "typename" it resolves correctly.
Comment 2 Vladimir Kvashin 2008-08-22 19:33:33 UTC
*** Issue 144893 has been marked as a duplicate of this issue. ***
Comment 3 Vladimir Kvashin 2008-08-22 19:34:22 UTC
Here is a better example (that does compile)
iter in for loop is unresolved, 
while on the next line is ok.

template<class K, class V> 
class normal_iterator {
};

template<class K, class V> 
class AssocVector {
public:
    typedef normal_iterator<K, V> iterator;
};

    
template<class AbstractProduct, typename IdentifierType>
class Factory {
    typedef AssocVector<IdentifierType, AbstractProduct> IdToProductMap;
    void foo() {
        for(typename IdToProductMap::iterator iter; ;) { // iter is unresolved
        }
        typename IdToProductMap::iterator iter; // ok
    }
};
Comment 4 Alexey Vladykin 2008-08-26 13:34:17 UTC
Fix + test: http://hg.netbeans.org/main/rev/f019f94e85fe
Comment 5 Quality Engineering 2008-08-28 06:39:45 UTC
Integrated into 'main-golden', available in build *200808280201* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/f019f94e85fe
User: Alexey Vladykin <alexey_vladykin@netbeans.org>
Log: Fixed IZ#144363: typename in for-loop leads to unresolved identifier error