stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Lemings (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
Date Wed, 14 Mar 2007 17:28:09 GMT
[gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
---------------------------------------------------------------

                 Key: STDCXX-359
                 URL: https://issues.apache.org/jira/browse/STDCXX-359
             Project: C++ Standard Library
          Issue Type: Bug
          Components: Build, Tests
    Affects Versions: 4.1.2, 4.1.3
            Reporter: Eric Lemings
             Fix For: 4.2


The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header
file as shown below.

     65 struct FmtSpec
     66 {
     67     // optional flags
     68     unsigned fl_minus  : 1;
...
     73 
     74     // optional length modifier
     75     enum Modifier {
     76         mod_none = 0,
     77         mod_h,       // short modifier
...
     86         mod_ext_I    // extension: int as ios::iostate
     87     };
     88 
     89     Modifier mod : 5;

(That may be the first time I've ever seen a bitfield defined in terms of an enumeration.
 But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown
here and fails to compile on Darwin platforms.

   2885     case 'S':   // %{S}, %{lS}, %{#*S}
   2886         if (   spec.mod == spec.mod_l
   2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width)
{
   2888             // std::wstring

This should probably be coded as an explicit equality/comparison to the Modifier enumerators.
 (Also there should probably be parentheses for explicit grouping around the logical OR (||)
operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence
over the logical OR operator but I'm not sure.)  A patch is shown below.

Index: tests/src/printf.cpp
===================================================================
--- tests/src/printf.cpp        (revision 517771)
+++ tests/src/printf.cpp        (working copy)
@@ -2883,8 +2883,8 @@
         break;
 
     case 'S':   // %{S}, %{lS}, %{#*S}
-        if (   spec.mod == spec.mod_l
-            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width)
{
+        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
+            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
             // std::wstring
             spec.param.ptr_ = PARAM (ptr_, pva);
 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message