[C++ PATCH] Fix PR/9154 (a trunk regression)
Giovanni Bajo
giovannibajo@libero.it
Fri Jun 20 15:25:00 GMT 2003
Falk Hueffner <falk.hueffner@student.uni-tuebingen.de> wrote:
>> the following patch fixes PR/9154 by modifying the new parser to identify
>> the ">>" token within a template argument list as a typo from the user
for
>> "> >", as it was done on the previous parser.
>
> But ">>" *can* occur in a template list:
>
> template <int N> int f() { return N; }
> int g() { return f<256 >> 4>(); }
>
> Is this handled correctly by your patch? In any case, something like
> this should be added to the test case.
Yes, beacuse I check for CPP_RSHIFT as terminator only for _type_ template
parameters, while in your example you're using non-type template parameters.
Also this is handled correctly:
template <int N = 123>>4>
struct c {};
But you are right, the testcase should probably keep this into account. I
attached a more complete testcase to this mail.
Giovanni Bajo
// { dg-do compile }
// Origin: <tilps at hotmail dot com>
// c++/9154: poor error message for ">>" vs "> >" in template argument list
template <class A>
class a {};
template <int N>
void b(void) {}
template <int N = 123>>4>
struct c {};
int main()
{
b<256 >> 4>();
a<a<int>> blah; // { dg-error "" "should be '> >' within" }
}
More information about the Gcc-patches
mailing list