Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354694

Summary: Fields of partially specialized types declared in headers fail to resolve
Product: [Tools] CDT Reporter: Kory Markevich <vulcannis>
Component: cdt-coreAssignee: Project Inbox <cdt-core-inbox>
Status: RESOLVED WORKSFORME QA Contact: Doug Schaefer <cdtdoug>
Severity: normal    
Priority: P3    
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Kory Markevich CLA 2011-08-13 19:15:23 EDT
Build Identifier: I20110620-1631

The marked lines in the following code are marked with field resolution errors. As shown, there are no errors if they are declared in the source file itself rather than a header file.

Test.h
--------
template < typename T, int c > class A { };
template < typename T > class A< T, 1 > { T v; };

struct B {
    A< int, 1 > f;
};

extern A< int, 1 > b;

Test.cpp
--------
#include "Test.h"

struct C {
    A< int, 1 > f;
};

void f( )
{
    A< int, 1 > a;
    a.v = 1; // No error

    C d;
    d.f.v = 1; // No error

    b.v = 1; // Error: Field 'v' could not be resolved

    B c;
    c.f.v = 1; // Error: Field 'v' could not be resolved
}



Reproducible: Always
Comment 1 Kory Markevich CLA 2011-08-13 19:16:32 EDT
Forgot to mention, looks like it may be related to bug 214017.
Comment 2 Markus Schorn CLA 2011-08-16 09:55:24 EDT
I cannot reproduce the issue. I have tried with CDT 8.0 and the latest version on the master branch.
What version of CDT are you using?
Comment 3 Kory Markevich CLA 2011-08-16 21:12:37 EDT
Version: 8.0.0.201106081058
Build id: 201106081058

Eclipse 4.1.0 (I20110620-1631.)

I just tried the sample code in a new, clean project and it worked fine. It fails as described when I use it in one of my existing projects. Must be some project-level config issue but I'm not sure what it would be.
Comment 4 Markus Schorn CLA 2011-08-17 02:11:46 EDT
You can try to rebuild the index for the project. If that does not help, please try to make the issue reproducable for me and reopen the bug with a small sample project.