[Bug c++/32039] Using declaration accepts non-visible members from base classes

2021-05-04 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32039

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

[Bug c++/32039] Using declaration accepts non-visible members from base classes

2015-01-10 Thread ville.voutilainen at gmail dot com
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.


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2015-01-10 Thread ville.voutilainen at gmail dot com
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. :)


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2015-01-10 Thread harald at gigawatt dot nl
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.


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2015-01-10 Thread ville.voutilainen at gmail dot com
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. :)


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2014-02-28 Thread fabien at gcc dot gnu.org
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)


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2014-02-28 Thread fabien at gcc dot gnu.org
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.


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2014-02-28 Thread fabien at gcc dot gnu.org
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.


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2014-02-28 Thread harald at gigawatt dot nl
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.


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2014-02-28 Thread fabien at gcc dot gnu.org
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.


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2011-11-21 Thread fabien at gcc dot gnu.org
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


[Bug c++/32039] Using declaration accepts non-visible members from base classes

2008-08-21 Thread gcc-bugzilla at contacts dot eelis dot net


--- 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