GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.

Bug 18541

Summary: "using" fails to make name visible without qualification
Product: gcc Reporter: Ivan Godard <igodard>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Severity: normal CC: gcc-bugs
Priority: P2    
Version: 3.4.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

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