public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25006] New: failure "using" a name contained in a class
@ 2005-11-23 18:47 fp at mc dot com
2005-11-23 18:51 ` [Bug c++/25006] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: fp at mc dot com @ 2005-11-23 18:47 UTC (permalink / raw)
To: gcc-bugs
The following code fails to compile:
namespace Foo {
struct Bar {
struct FooBar {};
};
}
using ::Foo::Bar::FooBar; // line 7
The error message being:
using.cpp:7: error: `Foo::Bar' is not a namespace
In the ISO C++ grammar [7.3.3], the using-declaration references a
"nested-name-specifier unqualified-id", not stating any restrictions
on the nested-name-specifier, which is composed of a sequence of
class-or-namespace-name [5.1].
--
Summary: failure "using" a name contained in a class
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fp at mc dot com
GCC build triplet: mingw-special
GCC host triplet: mingw-special
GCC target triplet: mingw-special
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25006
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/25006] failure "using" a name contained in a class
2005-11-23 18:47 [Bug c++/25006] New: failure "using" a name contained in a class fp at mc dot com
@ 2005-11-23 18:51 ` pinskia at gcc dot gnu dot org
2005-11-23 19:36 ` gdr at integrable-solutions dot net
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-23 18:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2005-11-23 18:51 -------
ICC rejects it as invalid too:
t.cc(7): error: a class-qualified name is not allowed
using ::Foo::Bar::FooBar; // line 7
So does Comeau with the same error message.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25006
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/25006] failure "using" a name contained in a class
2005-11-23 18:47 [Bug c++/25006] New: failure "using" a name contained in a class fp at mc dot com
2005-11-23 18:51 ` [Bug c++/25006] " pinskia at gcc dot gnu dot org
@ 2005-11-23 19:36 ` gdr at integrable-solutions dot net
2005-11-30 21:09 ` reichelt at gcc dot gnu dot org
2005-11-30 21:13 ` reichelt at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-11-23 19:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from gdr at integrable-solutions dot net 2005-11-23 19:36 -------
Subject: Re: failure "using" a name contained in a class
"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| ICC rejects it as invalid too:
| t.cc(7): error: a class-qualified name is not allowed
| using ::Foo::Bar::FooBar; // line 7
|
| So does Comeau with the same error message.
The construct is ill-formed -- sorry, someone needs to quote
chapter and verse. I'll do that later if no one beats me at it.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25006
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/25006] failure "using" a name contained in a class
2005-11-23 18:47 [Bug c++/25006] New: failure "using" a name contained in a class fp at mc dot com
2005-11-23 18:51 ` [Bug c++/25006] " pinskia at gcc dot gnu dot org
2005-11-23 19:36 ` gdr at integrable-solutions dot net
@ 2005-11-30 21:09 ` reichelt at gcc dot gnu dot org
2005-11-30 21:13 ` reichelt at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-11-30 21:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from reichelt at gcc dot gnu dot org 2005-11-30 21:09 -------
This is really invalid code.
Paragraph [7.3.3]/6 states:
A using-declaration for a class member shall be a member-declaration.
In your code snippet "using ::Foo::Bar::FooBar;" is a using-declaration
for "FooBar" which is a class member of the class "::Foo::Bar". But since
the using-declaration is not inside a class, it is not a member-declaration
- which violates [7.3.3]/6.
Or the other way round: Because the using-declaration for "FooBar" is not
inside a class, it cannot be a member-declaration according to [7.3.3]/6.
Therefore "::Foo::Bar" cannot be a class-name - it has to be a
namespace-name. And that's what GCC's error message says.
--
reichelt at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Status|UNCONFIRMED |RESOLVED
GCC build triplet|mingw-special |
GCC host triplet|mingw-special |
GCC target triplet|mingw-special |
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25006
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/25006] failure "using" a name contained in a class
2005-11-23 18:47 [Bug c++/25006] New: failure "using" a name contained in a class fp at mc dot com
` (2 preceding siblings ...)
2005-11-30 21:09 ` reichelt at gcc dot gnu dot org
@ 2005-11-30 21:13 ` reichelt at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-11-30 21:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from reichelt at gcc dot gnu dot org 2005-11-30 21:13 -------
> Or the other way round: Because the using-declaration for "FooBar" is not
> inside a class, it cannot be a member-declaration according to [7.3.3]/6.
> Therefore "::Foo::Bar" cannot be a class-name - it has to be a
> namespace-name. And that's what GCC's error message says.
Sorry, the "according to" is at the wrong place.
This should read:
Or the other way round: Because the using-declaration for "FooBar" is not
inside a class, it cannot be a member-declaration. Therefore "::Foo::Bar"
cannot be a class-name according to [7.3.3]/6. Which means it has to be
a namespace-name. And that's what GCC's error message says.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25006
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-11-30 21:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-23 18:47 [Bug c++/25006] New: failure "using" a name contained in a class fp at mc dot com
2005-11-23 18:51 ` [Bug c++/25006] " pinskia at gcc dot gnu dot org
2005-11-23 19:36 ` gdr at integrable-solutions dot net
2005-11-30 21:09 ` reichelt at gcc dot gnu dot org
2005-11-30 21:13 ` reichelt at gcc dot gnu dot org
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).