Menu

#40 Bug with template

open
nobody
None
5
2008-06-12
2008-06-12
Anonymous
No

Hello,

I think there is a bug in GC! when declaring a function of a template class with a 'class' template parameter.

Here is a repro case:

template<class C> void MyClass<C>::F()
{
assert(a1<b1);
assert(a2>b2);
}

I think this is because GC! wrongly assumes that the 'case' keyword starts a class definition, which is not the case here.

To fix the bug, I suggest to add the following lines at the beginning of the for loop in the function Grammar_Class:

if(pcur->i_SubSubID == TOKEN_WW_TEMPLATE
&& pcur->pst_Next
&& pcur->pst_Next->i_ID == TOKEN_LESS)
{
pcur = Tool_ToRelationNext(pcur->pst_Next);
}

Alexis Vaisse

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.