[3.4] New parser problem?

Richard Guenther rguenth@tat.physik.uni-tuebingen.de
Tue Feb 11 15:50:00 GMT 2003


Hi!

Shouldnt the new parser be able to disambiguate the following code?
(I know 3.2 and 3.3 cannot)

template<class T>
struct Foo {
        Foo(T&);
        void operator()();
};

void foo()
{
        double d;
        Foo<double>(d)();
}

> g++-3.4 -c tempobj.cpp
tempobj.cpp: In function `void foo()':
tempobj.cpp:11: error: `Foo<double> d()' redeclared as different kind of  symbol
tempobj.cpp:10: error: previous declaration of `double d'
tempobj.cpp:10: error: previous non-function declaration `double d'
tempobj.cpp:11: error: conflicts with function declaration `Foo<double> d()'

or am I required by the standard to write
        (Foo<double>(d))();
here (EDG based intel compiler complains, too)?

Note that changing the constructor to take more or less arguments
disambiguates, too. I.e.
        Foo<double>()();
and
        Foo<double>(d, d)();
are parsed ok.

Thoughts?

Richard.

--
Richard Guenther <richard.guenther@uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/



More information about the Gcc mailing list