libstdc++/7216: basic_iostream::traits_type is ambiguous issue

dens@stl.sarov.ru dens@stl.sarov.ru
Fri Jul 5 08:16:00 GMT 2002


>Number:         7216
>Category:       libstdc++
>Synopsis:       basic_iostream::traits_type is ambiguous issue
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 05 07:06:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Denis Nagorny
>Release:        libstdc++3-3.0.1-3
>Organization:
>Environment:
Linux RedHat 7.2
libstdc++3-3.0.1-3
gcc3-c++-3.0.1-3
>Description:
When I try to compile my program:

typedef std::char_traits<char> tCT;
typedef std::basic_iostream<char,tCT> Iostr;
int main(int,char*[])
{
    Iostr::traits_type * some;
    return 0;
}

with g++3 & your library compiler produce following message:

test.cpp:6: request for member `traits_type' is ambiguous
/usr/include/g++-v3/bits/std_ostream.h:54: candidates are: typedef struct 
   std::char_traits<char> std::basic_ostream<char, std::char_traits<char> 
   >::traits_type
/usr/include/g++-v3/bits/std_istream.h:54:                 typedef struct 
   std::char_traits<char> std::basic_istream<char, std::char_traits<char> 
   >::traits_type

I know that C++ standard 27.6.1.1 & 27.6.2.1 describes public types of classes basic_istream & basic_ostream such as:
 .......
public:
// Types (inherited from basic_ios (27.4.4)):
typedef charT            char_type;
typedef typename traits::int_type      int_type;
typedef typename traits::pos_type      pos_type;
typedef typename traits::off_type      off_type;
typedef traits                         traits_type;
 .............

But I believe that you can place this types in basic_ios only.
>How-To-Repeat:
Try to compile attached sample
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cpp"

I2luY2x1ZGUgPGlvc3RyZWFtPiAKdHlwZWRlZiBzdGQ6OmNoYXJfdHJhaXRzPGNoYXI+IHRDVDsK
dHlwZWRlZiBzdGQ6OmJhc2ljX2lvc3RyZWFtPGNoYXIsdENUPiBJb3N0cjsKaW50IG1haW4oaW50
LGNoYXIqW10pCnsKCUlvc3RyOjp0cmFpdHNfdHlwZSAqIHNvbWU7OwoJcmV0dXJuIDA7Cn0KCg==



More information about the Gcc-bugs mailing list