Bug 18541 - "using" fails to make name visible without qualification
Summary: "using" fails to make name visible without qualification
Status: RESOLVED DUPLICATE of bug 14258
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2004-11-18 12:16 UTC by Ivan Godard
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Godard 2004-11-18 12:16:04 UTC
#include <ostream>
template<typename ch = char, typename tr = std::char_traits<ch> >
class buffer : public std::basic_streambuf<ch, tr> {
    int_type    overflow(int_type c = tr::eof());

    typename int_type   overflow1(typename int_type c = tr::eof());

    using std::basic_streambuf<ch, tr>::int_type;

    int_type    overflow2(int_type c = tr::eof());

    typename int_type   overflow3(typename int_type c = tr::eof());

    std::basic_streambuf<ch, tr>::int_type  overflow4(
        std::basic_streambuf<ch, tr>::int_type c = tr::eof());

    typename std::basic_streambuf<ch, tr>::int_type overflow5(
        typename std::basic_streambuf<ch, tr>::int_type c = tr::eof());
int main() {
    buffer<> b;

gets you:

~/ootbc/common/test/src$ g++ foo.cc
foo.cc:5: error: `int_type' does not name a type
foo.cc:5: error: (perhaps `typename std::basic_streambuf<_CharT,
_Traits>::int_type' was intended)
foo.cc:8: error: expected nested-name-specifier before "int_type"
foo.cc:8: error: `int_type' does not name a type
foo.cc:8: error: (perhaps `typename std::basic_streambuf<_CharT,
_Traits>::int_type' was intended)
foo.cc:13: error: `int_type' does not name a type
foo.cc:13: error: (perhaps `typename std::basic_streambuf<_CharT,
_Traits>::int_type' was intended)
foo.cc:16: error: expected nested-name-specifier before "int_type"
foo.cc:16: error: `int_type' does not name a type
foo.cc:16: error: (perhaps `typename std::basic_streambuf<_CharT,
_Traits>::int_type' was intended)
foo.cc:19: error: ISO C++ forbids declaration of `int_type' with no type
foo.cc:19: error: cannot declare member `std::basic_streambuf<_CharT,
_Traits>::int_type' within `buffer<ch, tr>'
foo.cc:19: error: expected `;' before "overflow4"

As suggested in the error for "overflow" (good message BTW), the form used in 
"overflow5" works. But a "using" for the inherited name "int_type" does not make 
the name visible either directly (overflow2) or when tagged with "typename" 
(overflow 3). But the "using" doesn't complain either. If I can "using" it I 
should be able to "use" it :-)

Comment 1 Andrew Pinski 2004-11-18 12:25:54 UTC
Yes this is a bug in GCC, see PR 14258.

*** This bug has been marked as a duplicate of 14258 ***