This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Patch 3.0.1] Missing codecvt:: qualifier


Try the following little program:

typedef int error;
#include <iostream>

It fails because in codecvt.h there is a statement __ret = error;
This "error", however, is supposed to be the member of an enum in a
class in codecvt.h; the qualifier is missing. The bug can be handled by
the attached patch.
Note that similar bugs are likely to show up in different places. It is
a gcc bug that the compiler doesn't warn about the missing qualifier, I
believe. Not even with "-Wall -pedantic".

2001-07-29  Michael Piefel <piefel@informatik.hu-berlin.de>

	* include/bits/codecvt.cc: Add qualifier for 'error' enum.

--- include/bits/codecvt.h-orig      Fri Jul 27 11:11:39 2001
+++ include/bits/codecvt.h   Fri Jul 27 11:12:00 2001
@@ -394,7 +394,7 @@
           extern_type* __to, extern_type* __to_end,
           extern_type*& __to_next) const
     {
-      result __ret = error;
+      result __ret = codecvt::error;
       if (__state._M_good())
        {
          typedef state_type::__desc_type       __desc_type;
@@ -438,7 +438,7 @@
            {
              __from_next = reinterpret_cast<const intern_type*>(__cfrom);
              __to_next = reinterpret_cast<extern_type*>(__cto);
-             __ret = ok;
+             __ret = codecvt::ok;
            }
          else
            {
@@ -446,10 +446,10 @@
                {
                  __from_next = reinterpret_cast<const intern_type*>(__cfrom);
                  __to_next = reinterpret_cast<extern_type*>(__cto);
-                 __ret = partial;
+                 __ret = codecvt::partial;
                }
              else
-               __ret = error;
+               __ret = codecvt::error;
            }
        }
       return __ret;
@@ -461,7 +461,7 @@
     do_unshift(state_type& __state, extern_type* __to,
               extern_type* __to_end, extern_type*& __to_next) const
     {
-      result __ret = error;
+      result __ret = codecvt::error;
       if (__state._M_good())
        {
          typedef state_type::__desc_type       __desc_type;
@@ -479,14 +479,14 @@
            {
              __to_next = reinterpret_cast<extern_type*>(__cto);
              if (__tlen == __tmultiple * (__to_end - __to))
-               __ret = noconv;
+               __ret = codecvt::noconv;
              else if (__tlen == 0)
-               __ret = ok;
+               __ret = codecvt::ok;
              else
-               __ret = partial;
+               __ret = codecvt::partial;
            }
          else
-           __ret = error;
+           __ret = codecvt::error;
        }
       return __ret;
     }
@@ -499,7 +499,7 @@
          intern_type* __to, intern_type* __to_end,
          intern_type*& __to_next) const
     {
-      result __ret = error;
+      result __ret = codecvt::error;
       if (__state._M_good())
        {
          typedef state_type::__desc_type       __desc_type;
@@ -544,7 +544,7 @@
            {
              __from_next = reinterpret_cast<const extern_type*>(__cfrom);
              __to_next = reinterpret_cast<intern_type*>(__cto);
-             __ret = ok;
+             __ret = codecvt::ok;
            }
          else
            {
@@ -552,10 +552,10 @@
                {
                  __from_next = reinterpret_cast<const extern_type*>(__cfrom);
                  __to_next = reinterpret_cast<intern_type*>(__cto);
-                 __ret = partial;
+                 __ret = codecvt::partial;
                }
              else
-               __ret = error;
+               __ret = codecvt::error;
            }
        }
       return __ret;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]