<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - iterators already defined for std::vector when using std::decimal"
   href="https://bugs.llvm.org/show_bug.cgi?id=37831">37831</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>iterators already defined for std::vector when using std::decimal
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zhonghao@pku.org.cn
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The code is as follow:

#include <decimal/decimal>
#include <vector>

int main()
{
    std::vector<std::decimal::decimal32> vec;

    if (vec.empty())
    {
        vec.push_back(std::decimal::decimal32(0));
    }

    return 0;
}

clang++ produce a long list of error messages, when compiling the above code:

In file included from
/home/haozhong/project/approach/otherreport/gcc/tmp/gcc_44473/2Examplecode.cpp:1:
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:230:47:
error: unknown machine mode 'SD'
        typedef float __decfloat32 __attribute__((mode(SD)));
                                                  ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:251:5:
error: constructor cannot be redeclared
        decimal32(__decfloat32 __z)                 : __val(__z) {}
        ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:238:14:
note: previous definition is here
        explicit decimal32(float __r)               : __val(__r) {}
                 ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:233:36:
error: invalid suffix 'DF' on floating constant
        decimal32()                                 : __val(0.e-101DF) {}
                                                                   ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:316:47:
error: unknown machine mode 'DD'
        typedef float __decfloat64 __attribute__((mode(DD)));
                                                  ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:337:5:
error: constructor cannot be redeclared
        decimal64(__decfloat64 __z)                 : __val(__z) {}
        ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:324:14:
note: previous definition is here
        explicit decimal64(float __r)               : __val(__r) {}
                 ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:319:36:
error: invalid suffix 'dd' on floating constant
        decimal64()                                 : __val(0.e-398dd) {}
                                                                   ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:402:48:
error: unknown machine mode 'TD'
        typedef float __decfloat128 __attribute__((mode(TD)));
                                                   ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:424:5:
error: constructor cannot be redeclared
        decimal128(__decfloat128 __z)               : __val(__z) {}
        ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:410:14:
note: previous definition is here
        explicit decimal128(float __r)              : __val(__r) {}
                 ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:405:37:
error: invalid suffix 'DL' on floating constant
        decimal128()                                : __val(0.e-6176DL) {}
                                                                    ^
    In file included from
/home/haozhong/project/approach/otherreport/gcc/tmp/gcc_44473/2Examplecode.cpp:1:
    In file included from
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal:492:
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:127:22:
error: invalid suffix 'DF' on floating constant
            __multiplier = 1.E-1DF;
                                ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:131:26:
error: invalid suffix 'DF' on floating constant
          __multiplier = 1.E1DF;
                             ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:145:22:
error: invalid suffix 'DF' on floating constant
            __multiplier = 1.E-1DF;
                                ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:149:26:
error: invalid suffix 'DF' on floating constant
          __multiplier = 1.E1DF;
                             ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:163:22:
error: invalid suffix 'DD' on floating constant
            __multiplier = 1.E-1DD;
                                ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:167:26:
error: invalid suffix 'DD' on floating constant
          __multiplier = 1.E1DD;
                             ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:181:22:
error: invalid suffix 'DD' on floating constant
            __multiplier = 1.E-1DD;
                                ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:185:26:
error: invalid suffix 'DD' on floating constant
          __multiplier = 1.E1DD;
                             ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:199:22:
error: invalid suffix 'DL' on floating constant
            __multiplier = 1.E-1DL;
                                ^
   
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/../../../../include/c++/8.0.1/decimal/decimal.h:203:26:
error: invalid suffix 'DL' on floating constant
          __multiplier = 1.E1DL;
                             ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.

In the contrast, gcc++ compiles it without any errors. The code sample comes
from a gcc bug report:<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44473">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44473</a>

The programmers discuss this problem in details. Would you please read the
discussions? I believe that clang++ shall fix the problem.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>