Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333285 - Bogus syntax error for non-type template parameter starting with keyword 'typename' or 'class'
Summary: Bogus syntax error for non-type template parameter starting with keyword 'typ...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-28 17:58 EST by Nathan Ridge CLA
Modified: 2011-01-07 06:23 EST (History)
1 user (show)

See Also:


Attachments
testcase + fix (10.00 KB, patch)
2011-01-07 06:12 EST, Markus Schorn CLA
mschorn.eclipse: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2010-12-28 17:58:32 EST
The parser marks as a syntax error the following valid code:

template <typename T>
struct A
{
    typedef Ttype;
};

template <typename T>
struct X
{
    template <typename A<T>::type x>  // SYNTAX ERROR HERE
    struct Y
    {
        
    };
};

Notice that in spite of the presence of "typename", the template paramter of Y is a non-type template parameter. The type of the template parameter is "typename A<T>::type", and the name of the template parameter is "x". The "typename" is necessary because A<T> is a dependent type.
Comment 1 Nathan Ridge CLA 2010-12-28 17:59:49 EST
Apologies, there is a typo inside struct A: that should be "typedef T type;", with a space.
Comment 2 Markus Schorn CLA 2011-01-07 06:12:21 EST
Created attachment 186259 [details]
testcase + fix

Thanks for the example!
Comment 3 Markus Schorn CLA 2011-01-07 06:18:01 EST
Fixed in 8.0 > 20110107.