Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.

Bug 65211

Summary: Bad: iostream::traits_type is ambiguous
Product: [Retired] Red Hat Linux Reporter: Need Real Name <dens>
Component: libstdc++Assignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: dens
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
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: ---

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