[ 
https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Sebor closed STDCXX-359.
-------------------------------

    Resolution: Fixed

Assuming the committed patch successfully works around the gcc bug. If not, 
please reopen.

> [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.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon 
> Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             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.

Reply via email to