public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: CVS head (gcc-3.4), new parser, and should variable names interfere with namespace names?
@ 2002-12-31 11:11 Neil Booth
  2002-12-31 15:33 ` Mark Mitchell
  0 siblings, 1 reply; 6+ messages in thread
From: Neil Booth @ 2002-12-31 11:11 UTC (permalink / raw)
  To: Gabriel Dos Reis, gcc, Andrew Pollard

> Andrew Pollard <andrewp@andypo.net> writes:
> 
> | Hi All,
> | 
> |  With the recent parser changes, the following snippet of code now
> | doesn't compile...
> | 
> | namespace.cxx:
> | -----------------------
> | namespace foo {
> |     int baz(int);
> | }
> | 
> | int
> | bar(int foo)
> 
> This foo hides ::foo.
> 
> [...]
> 
> | Is the parser just being more standard conforming,
> 
> Yes.

Hi Gaby,

I'm no C++ expert, but are you sure?  Comeau accepts it in strict mode,
and your answer is not how I read 3.4.3p1 which I assume is the relevant
paragraph.

Neil.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CVS head (gcc-3.4), new parser, and should variable names interfere with namespace names?
  2002-12-31 11:11 CVS head (gcc-3.4), new parser, and should variable names interfere with namespace names? Neil Booth
@ 2002-12-31 15:33 ` Mark Mitchell
  2002-12-31 19:41   ` Gabriel Dos Reis
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Mitchell @ 2002-12-31 15:33 UTC (permalink / raw)
  To: Neil Booth, Gabriel Dos Reis, gcc, Andrew Pollard; +Cc: mark



--On Tuesday, December 31, 2002 05:16:22 PM +0000 Neil Booth 
<neil@daikokuya.co.uk> wrote:

>> Andrew Pollard <andrewp@andypo.net> writes:
>>
>> | Hi All,
>> |
>> |  With the recent parser changes, the following snippet of code now
>> | doesn't compile...
>> |
>> | namespace.cxx:
>> | -----------------------
>> | namespace foo {
>> |     int baz(int);
>> | }
>> |
>> | int
>> | bar(int foo)
>>
>> This foo hides ::foo.
>>
>> [...]
>>
>> | Is the parser just being more standard conforming,
>>
>> Yes.
>
> Hi Gaby,
>
> I'm no C++ expert, but are you sure?  Comeau accepts it in strict mode,
> and your answer is not how I read 3.4.3p1 which I assume is the relevant
> paragraph.

I think this is indeed a bug in the new parser.

I will work on a fix.

I hate it when I make mistakes.

-- 
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CVS head (gcc-3.4), new parser, and should variable names interfere with namespace names?
  2002-12-31 15:33 ` Mark Mitchell
@ 2002-12-31 19:41   ` Gabriel Dos Reis
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Dos Reis @ 2002-12-31 19:41 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Neil Booth, gcc, Andrew Pollard

Mark Mitchell <mark@codesourcery.com> writes:

| --On Tuesday, December 31, 2002 05:16:22 PM +0000 Neil Booth
| <neil@daikokuya.co.uk> wrote:
| 
| >> Andrew Pollard <andrewp@andypo.net> writes:
| >>
| >> | Hi All,
| >> |
| >> |  With the recent parser changes, the following snippet of code now
| >> | doesn't compile...
| >> |
| >> | namespace.cxx:
| >> | -----------------------
| >> | namespace foo {
| >> |     int baz(int);
| >> | }
| >> |
| >> | int
| >> | bar(int foo)
| >>
| >> This foo hides ::foo.
| >>
| >> [...]
| >>
| >> | Is the parser just being more standard conforming,
| >>
| >> Yes.
| >
| > Hi Gaby,
| >
| > I'm no C++ expert, but are you sure?  Comeau accepts it in strict mode,
| > and your answer is not how I read 3.4.3p1 which I assume is the relevant
| > paragraph.
| 
| I think this is indeed a bug in the new parser.

Oops, Neil is right.  I went back doing my homework and found that the
new parser is indeed in error.  The paragraph 3.4.3/1 Neil quoted
actually gave a similar example.

Sorry for the confusion.

-- Gaby

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CVS head (gcc-3.4), new parser, and should variable names interfere with namespace names?
  2002-12-31  4:25 ` Gabriel Dos Reis
@ 2002-12-31  7:13   ` Andrew Pollard
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Pollard @ 2002-12-31  7:13 UTC (permalink / raw)
  To: gdr; +Cc: gcc


Gabriel Dos Reis <gdr@integrable-solutions.net> replied:

>| Hi All,
>| 
>|  With the recent parser changes, the following snippet of code now
>| doesn't compile...
>| 
>| namespace.cxx:
>| -----------------------
>| namespace foo {
>|     int baz(int);
>| }
>| 
>| int
>| bar(int foo)
>
>This foo hides ::foo.
>
>[...]
>
>| Is the parser just being more standard conforming,
>
>Yes.

Thought so. Thanks.

Andrew.
--
 Andrew Pollard, Brooks-PRI Automation  | home: andrew@andypo.net
670 Eskdale Road, Winnersh Triangle, UK | work: Andrew.Pollard@brooks-pri.com
 Tel/Fax:+44 (0)118 9215603 / 9215660   | http://www.andypo.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CVS head (gcc-3.4), new parser, and should variable names interfere with namespace names?
  2002-12-31  3:58 Andrew Pollard
@ 2002-12-31  4:25 ` Gabriel Dos Reis
  2002-12-31  7:13   ` Andrew Pollard
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel Dos Reis @ 2002-12-31  4:25 UTC (permalink / raw)
  To: Andrew Pollard; +Cc: gcc

Andrew Pollard <andrewp@andypo.net> writes:

| Hi All,
| 
|  With the recent parser changes, the following snippet of code now
| doesn't compile...
| 
| namespace.cxx:
| -----------------------
| namespace foo {
|     int baz(int);
| }
| 
| int
| bar(int foo)

This foo hides ::foo.

[...]

| Is the parser just being more standard conforming,

Yes.

-- Gaby

^ permalink raw reply	[flat|nested] 6+ messages in thread

* CVS head (gcc-3.4), new parser, and should variable names interfere with namespace names?
@ 2002-12-31  3:58 Andrew Pollard
  2002-12-31  4:25 ` Gabriel Dos Reis
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Pollard @ 2002-12-31  3:58 UTC (permalink / raw)
  To: gcc


Hi All,

 With the recent parser changes, the following snippet of code now
doesn't compile...

namespace.cxx:
-----------------------
namespace foo {
    int baz(int);
}

int
bar(int foo)
{
    return (foo::baz(foo));
}
------------------------

% g++34 namespace.cxx
namespace.cxx: In function `int bar(int)':
namespace.cxx:8: error: `foo' is not a class-name or namespace-name
namespace.cxx:8: error: `foo' is not a class-name or namespace-name
namespace.cxx:8: error: `foo' is not a class-name or namespace-name
namespace.cxx:8: error: `foo' is not a class-name or namespace-name
namespace.cxx:8: error: `baz' undeclared (first use this function)
namespace.cxx:8: error: (Each undeclared identifier is reported only once for
   each function it appears in.)

Whereas gcc-3.3.x and earlier do compile it.

Is the parser just being more standard conforming, or should it be
able to work out what is meant here? ie should the definition of 'int
foo' be hiding the 'namespace foo'?

Fully qualifing the namespace makes it work again... ie

    return (::foo::baz(foo));

Andrew.
--
 Andrew Pollard, Brooks-PRI Automation  | home: andrew@andypo.net
670 Eskdale Road, Winnersh Triangle, UK | work: Andrew.Pollard@brooks-pri.com
 Tel/Fax:+44 (0)118 9215603 / 9215660   | http://www.andypo.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-12-31 22:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-31 11:11 CVS head (gcc-3.4), new parser, and should variable names interfere with namespace names? Neil Booth
2002-12-31 15:33 ` Mark Mitchell
2002-12-31 19:41   ` Gabriel Dos Reis
  -- strict thread matches above, loose matches on Subject: below --
2002-12-31  3:58 Andrew Pollard
2002-12-31  4:25 ` Gabriel Dos Reis
2002-12-31  7:13   ` Andrew Pollard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).