[C++ PATCH] Fix PR/9154 (a trunk regression)
Giovanni Bajo
giovannibajo@libero.it
Sat Jun 21 04:42:00 GMT 2003
Wolfgang Bangerth <bangerth@ices.utexas.edu> wrote:
> [Note that I'm poking wildly in the dark because I don't know anything of
> gcc internals, but got the impression that there are really weird cases
for
> this...]
I think that what I'm doing is reasonably safe. When parsing a single *TYPE*
template argument, GCC was looking for either a comma or a > as terminator
for it. With my patch, it also accepts a >>, but emits an error. In all your
examples, you are using ">>" in the middle of a expression (which is a
non-type parameter), so my code does not affect it.
> How about
>
> template <int> struct A {
> typedef int I;
> };
>
> template <typename T = A< 1>>2 >::I>
> struct X {};
It works as expected. Added to the testcase as shown above.
Giovanni Bajo
// { dg-do compile }
// Origin: <tilps at hotmail dot com>
// c++/9154: poor error message for ">>" vs "> >" in template argument list
template <class T>
class A {};
template <int N>
void B(void) {}
template <int N = 123>>4>
struct C {};
template <int> struct D {};
template <typename> struct E {};
E<D< 1>>2 > > E1;
const int x = 0;
E<D< 1>>x > > E2;
template <int> struct F {
typedef int I;
};
template <typename T = F< 1>>2 >::I>
struct G {};
int main()
{
B<256 >> 4>();
A<A<int>> blah; // { dg-error "" "should be '> >' within" }
}
More information about the Gcc-patches
mailing list