Bug 71504

Summary: Compilation errors with -U__GNUC__ flag using STL header string
Product: [Retired] Red Hat Linux Reporter: Need Real Name <ssurve>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: high    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-08-16 08:50:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Log file of the compilation errors generated none

Description Need Real Name 2002-08-14 14:45:55 UTC
Description of Problem:
Getting compilation errors while compiling  a particular .cpp file which
includes STL header file <string> , with flag __GNUC__ undefined.

Version-Release number of selected component (if applicable):
gcc 2.96-98

How Reproducible:
Reproducible

Steps to Reproduce:
1.  Create a cpp source file as follows:
#include <string>

int main() { 
  string s(10u, ' ');           // Create a string of ten blanks.

  const char* A = "this is a test";
  s += A;
  cout << "s = " << (s + '\n');
}

2. Compile the above source file with flag -U__GNUC__ 
e.g. g++ -U__GNUC__ stl.cpp

Actual Results:
Please refer to the attached log file (error.log) for the error messages
generated.

Expected Results:
The above source file should get compiled.

Additional Information:
The problem seems to be with /usr/include/g++-3/std/bastring.h
If the macro __STL_CLASS_PARTIAL_SPECIALIZATION is not defined, then the number
of parameters passed to class reverse_iterator needs to be different.

Comment 1 Need Real Name 2002-08-14 14:47:45 UTC
Created attachment 70604 [details]
Log file of the compilation errors generated

Comment 2 Jakub Jelinek 2002-08-16 06:26:58 UTC
Why are you doing that? The old libstdc++ certainly is not meant to be used
by compilers other than g++.

Comment 3 Need Real Name 2002-08-16 08:50:15 UTC
We need to use this flag -U__GNUC__  while using EDG because the EDG version
2.45.2 does not support g++ extensions. And one of our customers wants to
include stl header string while generating the front end with EDG.

Please have a look on the following typedef in /usr/include/g++-3/stl_rope.h :

#     ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
        typedef reverse_iterator<const_iterator> const_reverse_iterator;
#     else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
        typedef reverse_iterator<const_iterator, value_type, const_reference,
                                 difference_type>  const_reverse_iterator;
#     endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */

Why don't we have a similar typedef done in /usr/include/g++-3/std/bastring.h?

Comment 4 Jakub Jelinek 2002-08-16 09:48:23 UTC
With EDG frontend the corresponding STL should be used.
With STL from gcc 3.x you'll have even much harder time to use it with
another frontend...