Possible parser problem in v1.1.1

Alexandre Oliva oliva@dcc.unicamp.br
Wed Mar 24 04:28:00 GMT 1999


On Mar 24, 1999, Peter Chapin <pchapin@twilight.vtc.vsc.edu> wrote:

>   // Declares an object named vec, not a function named vec.
>   std::vector<int>
>     vec(std::istream_iterator<int>(std::cin), std::istream_iterator<int>());

Nope, it does declare a function, as required by the Standard.  If you 
mean to define an object, you must disambiguate the declaration, for
example, by using a cast:

>   std::vector<int>
>     vec((std::istream_iterator<int>)(std::cin), std::istream_iterator<int>());
          ^                          ^

> I don't believe such a qualifier could be present on a dummy name in
> a parameter declaration.

It could not, but the Standard mandates the disambiguation to be
merely syntatic, and the fact that std::cin is an invalid parameter
name is to be considered after the disambiguation has already taken
place.

> In fact, I'm not totally convinced that this is really a bug at all.

It is not.  But thanks for the bug report anyway.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Brasil
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,egcs.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists



More information about the Gcc-bugs mailing list