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

Bug 357320

Summary: Incorrect "Member declaration not found" in template class
Product: [Tools] CDT Reporter: Geoff Alexander <gdlxn>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, gdlxn
Version: 8.0   
Target Milestone: 8.0.2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Eclipse workspace containing small example illustrating the problem none

Description Geoff Alexander CLA 2011-09-11 00:48:17 EDT
Created attachment 203119 [details]
Eclipse workspace containing small example illustrating the problem

I've attached an Eclipse workspace containing a small example illustrating the
problem. In this example, the template class C1 compiles just fine.  However, CDT is incorrectly reporting a "Member declaration not found":

Description	Resource	Path	Location	Type
Member declaration not found	C1.tpl	/Example/include	line 5	Semantic Error
Comment 1 Markus Schorn CLA 2011-09-16 05:41:17 EDT
Thanks, the example can be simplified to:

// a.h
template<class T> struct C1 {
    typedef int iterator;
    iterator m1();
};

// a.cpp
template<class T> typename C1<T>::iterator C1<T>::m1() {
   return 0;
}
Comment 2 Markus Schorn CLA 2011-09-16 06:58:20 EDT
Added testcase and fix.
Comment 3 CDT Genie CLA 2011-09-16 07:23:02 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 357320: Class template usage in method definded outside of class body.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=b9e57bcf8c1aa970a02e72c7dc9d566de6854ee1
Comment 4 CDT Genie CLA 2011-09-19 08:23:07 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 357320: Class template usage in method defined outside of class body.

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