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

Bug 368610

Summary: [regression] 'auto' type deduction failure involving templates
Product: [Tools] CDT Reporter: Nathan Ridge <zeratul976>
Component: cdt-indexerAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.1.0   
Target Milestone: 8.1.0   
Hardware: All   
OS: All   
Whiteboard:

Description Nathan Ridge CLA 2012-01-14 19:51:12 EST
struct S
{
    int x;
};

template <typename>
struct iterator_base
{
    S operator*();
};

template <typename>
struct A
{
    struct iterator : public iterator_base<iterator>
    {
    };
};

int main()
{
    A<int>::iterator it;
    auto s = *it;
    s.x;  // ERROR HERE: "Field 'x' could not be resolved"
}


The error goes away if either class is made a nontemplate.

This worked fine in previous Juno builds.
Comment 1 Markus Schorn CLA 2012-01-16 09:33:42 EST
Added testcases and fix.
Comment 2 Nathan Ridge CLA 2012-01-18 10:46:54 EST
Thanks Markus for your prompt bug fixes!

I'm done with reporting bugs for a while, as the vast majority of the remaining false positive errors in our codebase reduce to uses of dependent expressions :)
Comment 3 CDT Genie CLA 2012-02-29 13:21:42 EST
*** cdt git genie on behalf of Markus Schorn ***

    Bug 368610: Specialization of classes used as template args

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=66f92bb58277c3cc845249c089b0bf28b9e0312e