public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
@ 2011-11-22 8:51 ` fabien at gcc dot gnu.org
2014-02-28 21:41 ` fabien at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-11-22 8:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
fabien at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-11-22
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
2011-11-22 8:51 ` [Bug c++/32039] Using declaration accepts non-visible members from base classes fabien at gcc dot gnu.org
@ 2014-02-28 21:41 ` fabien at gcc dot gnu.org
2014-02-28 21:43 ` fabien at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fabien at gcc dot gnu.org @ 2014-02-28 21:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
--- Comment #2 from fabien at gcc dot gnu.org ---
(In reply to Andrew Stubbs from comment #0)
> The problem should be that B::foo hides A::foo from class C. Clause 7.3.3/14
> of the C++ standard says the using declaration should not work, in this case
> - class A is not a direct base class of class C. However, GCC 4.1.1 accepts
> it with no diagnostic.
7.3.3/14 says "...The base class members mentioned by a using-declaration shall
be visible in the scope of at least one of the direct base classes of the class
where the using-declaration is specified..."
In the example above, A (from using A::foo) is visible from its direct base
class B. Consequently, it is valid. Adding 'using A::foo' within B does not
change anything to that.
without 'using A::foo':
'int B::foo(long)' hides int A::foo(int) in B
and 'using A::foo' brings 'int A::foo(int)' into C and hides 'int
B::foo(long)'.
with 'using A::foo':
two overloads of 'foo' are present in B: 'int B::foo(long)' and 'int
A::foo(int)' (brought into B scope by the using-declaration).
and 'using A::foo' brings 'int A::foo(int)' into C and hides 'int B::foo(long)'
(and 'using A::foo)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
2011-11-22 8:51 ` [Bug c++/32039] Using declaration accepts non-visible members from base classes fabien at gcc dot gnu.org
2014-02-28 21:41 ` fabien at gcc dot gnu.org
@ 2014-02-28 21:43 ` fabien at gcc dot gnu.org
2014-02-28 21:53 ` fabien at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fabien at gcc dot gnu.org @ 2014-02-28 21:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
--- Comment #3 from fabien at gcc dot gnu.org ---
(In reply to Eelis from comment #1)
> Still accepted by 4.4. Comeau concurs with reporter, and rejects saying:
>
> line 15: error: class member designated by a
> using-declaration must be visible in a direct base class
Which seems wrong according to the standard quoted above.
>From Clang results and the analysis done in bug 19377, I am inclined to close
this bug as invalid.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2014-02-28 21:43 ` fabien at gcc dot gnu.org
@ 2014-02-28 21:53 ` fabien at gcc dot gnu.org
2014-03-01 0:03 ` harald at gigawatt dot nl
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fabien at gcc dot gnu.org @ 2014-02-28 21:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
fabien at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from fabien at gcc dot gnu.org ---
Closed as invalid.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2014-02-28 21:53 ` fabien at gcc dot gnu.org
@ 2014-03-01 0:03 ` harald at gigawatt dot nl
2014-03-01 7:53 ` fabien at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: harald at gigawatt dot nl @ 2014-03-01 0:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
Harald van Dijk <harald at gigawatt dot nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |harald at gigawatt dot nl
--- Comment #5 from Harald van Dijk <harald at gigawatt dot nl> ---
This bug is about visibility, bug 19337 is about accessibility. I incorrectly
used "visibility" in my comment on the other bug, I apologise if that has
confused matters. The comments there do not apply here.
Normally, a qualified name such as A::foo can be used to refer to a hidden
member. In this instance, however, the standard makes a special exception, and
states that A::foo must be visible in B as well, even though a qualified name
is used, for the using declaration to be valid.
In B, int A::foo(int) is hidden by int B::foo(long) because B's member function
has the same name. (3.3.10p1) A name is said to be visible, if it is in scope,
and not hidden. (3.3.10p5)
So I think this bug report is valid and unrelated to 19337: A's member function
is indeed not visible in any of the direct bases of C.
Your comment (the "In the example above, A (from using A::foo) is visible" bit)
suggests that you read the standard as requiring that the base class be
visible, rather than the base class member.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2014-03-01 0:03 ` harald at gigawatt dot nl
@ 2014-03-01 7:53 ` fabien at gcc dot gnu.org
2015-01-10 16:46 ` ville.voutilainen at gmail dot com
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fabien at gcc dot gnu.org @ 2014-03-01 7:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
fabien at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |ASSIGNED
Resolution|INVALID |---
--- Comment #6 from fabien at gcc dot gnu.org ---
(In reply to Harald van Dijk from comment #5)
[...]
> Your comment (the "In the example above, A (from using A::foo) is visible"
> bit) suggests that you read the standard as requiring that the base class be
> visible, rather than the base class member.
Obviously should read members of A are visible... Anyway thanks for the
clarification.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2014-03-01 7:53 ` fabien at gcc dot gnu.org
@ 2015-01-10 16:46 ` ville.voutilainen at gmail dot com
2015-01-10 17:27 ` harald at gigawatt dot nl
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-10 16:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
CC| |ville.voutilainen at gmail dot com
Resolution|--- |INVALID
--- Comment #7 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
This is invalid. [namespace.udecl]/3 says that if the declaration names
a constructor, the nested-name-specifier shall name a direct base, but if
the declaration names something else than a constructor, indirect bases are
fine. The name is looked up by member name lookup, which will look in A first,
and
the hiding in B does not matter. Clang agrees with this interpretation.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2015-01-10 16:46 ` ville.voutilainen at gmail dot com
@ 2015-01-10 17:27 ` harald at gigawatt dot nl
2015-01-10 17:32 ` ville.voutilainen at gmail dot com
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: harald at gigawatt dot nl @ 2015-01-10 17:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
--- Comment #8 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to Ville Voutilainen from comment #7)
> This is invalid. [namespace.udecl]/3 says that if the declaration names
> a constructor, the nested-name-specifier shall name a direct base, but if
> the declaration names something else than a constructor, indirect bases are
> fine.
Yes, but you're ignoring p14 (now p17 in N4140) which was mentioned right in
the initial report, which adds "The base class members mentioned by a
using-declaration shall be visible in the scope of at least one of the direct
base classes of the class where the using-declaration is specified." That is
not limited to constructors, that is a separate requirement in the standard
that GCC and clang both fail to implement.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2015-01-10 17:27 ` harald at gigawatt dot nl
@ 2015-01-10 17:32 ` ville.voutilainen at gmail dot com
2015-01-10 18:12 ` ville.voutilainen at gmail dot com
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-10 17:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |NEW
Resolution|INVALID |---
--- Comment #9 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Pardon that, I failed to notice that part (and yes, sorry I missed it in the
original report). Back to open, then.
I think the standard needs to be clarified about what it wants. :)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2015-01-10 17:32 ` ville.voutilainen at gmail dot com
@ 2015-01-10 18:12 ` ville.voutilainen at gmail dot com
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-10 18:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
--- Comment #10 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Ok, this is
http://open-std.org/JTC1/SC22/WG21/docs/cwg_closed.html#1960
which says
"The rule was introduced because the hiding of a base class member by an
intermediate derived class is potentially intentional and should not be capable
of circumvention by a using-declaration in a derived class. The consensus of
CWG preferred not to change the restriction."
So yes, we need to fix this. :)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2015-01-10 18:12 ` ville.voutilainen at gmail dot com
@ 2021-05-04 12:31 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-04 12:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/32039] Using declaration accepts non-visible members from base classes
2007-05-22 12:07 [Bug c++/32039] New: " andrew dot stubbs at st dot com
@ 2008-08-21 12:01 ` gcc-bugzilla at contacts dot eelis dot net
0 siblings, 0 replies; 12+ messages in thread
From: gcc-bugzilla at contacts dot eelis dot net @ 2008-08-21 12:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from gcc-bugzilla at contacts dot eelis dot net 2008-08-21 12:00 -------
Still accepted by 4.4. Comeau concurs with reporter, and rejects saying:
line 15: error: class member designated by a
using-declaration must be visible in a direct base class
--
gcc-bugzilla at contacts dot eelis dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc-bugzilla at contacts dot
| |eelis dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-05-04 12:31 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-32039-4@http.gcc.gnu.org/bugzilla/>
2011-11-22 8:51 ` [Bug c++/32039] Using declaration accepts non-visible members from base classes fabien at gcc dot gnu.org
2014-02-28 21:41 ` fabien at gcc dot gnu.org
2014-02-28 21:43 ` fabien at gcc dot gnu.org
2014-02-28 21:53 ` fabien at gcc dot gnu.org
2014-03-01 0:03 ` harald at gigawatt dot nl
2014-03-01 7:53 ` fabien at gcc dot gnu.org
2015-01-10 16:46 ` ville.voutilainen at gmail dot com
2015-01-10 17:27 ` harald at gigawatt dot nl
2015-01-10 17:32 ` ville.voutilainen at gmail dot com
2015-01-10 18:12 ` ville.voutilainen at gmail dot com
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
2007-05-22 12:07 [Bug c++/32039] New: " andrew dot stubbs at st dot com
2008-08-21 12:01 ` [Bug c++/32039] " gcc-bugzilla at contacts dot eelis dot net
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).