Bug 65211 - Bad: iostream::traits_type is ambiguous
Bad: iostream::traits_type is ambiguous
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: libstdc++ (Show other bugs)
7.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-20 08:41 EDT by Need Real Name
Modified: 2007-04-18 12:42 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-01 11:13:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2002-05-20 08:41:17 EDT
Description of Problem:

When I try to compile following code:

// ... skipped
 typedef STD basic_iostream<Char,It> Iostr;
 Iostr::traits_type * some = (It*)0;
// ... skipped

Compiler tells me that member `traits_type' is ambiguous and candidates are
placed in basic_ostream and basic_istream.

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 these typedefs can be placed in basic_ios only. 
Version-Release number of selected component (if applicable):


How Reproducible:
Try to compile source code which contains refference to iostream::traits_type

Steps to Reproduce:
1.  Try to compile source code which contains refference to iostream::traits_type
2. 
3. 

Actual Results:
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

Expected Results:
Code should be compiled without any errors.

Additional Information:
Comment 1 Benjamin Kosnik 2004-10-01 11:13:00 EDT
Dunno what's up with this bug, report itself is ambiguous. Please
reopen and provide source to your problem if you feel this is still an
active issue.

This works with gcc-3.3.x and gcc-3.4.x:


#include <iostream>

int main()
{
  typedef std::basic_iostream<char, std::char_traits<char> > Iostr;
  Iostr::traits_type* some = NULL;
}

Note You need to log in before you can comment on or make changes to this bug.