[llvm-bugs] [Bug 37831] New: iterators already defined for std::vector when using std::decimal

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 18 01:42:47 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37831

            Bug ID: 37831
           Summary: iterators already defined for std::vector when using
                    std::decimal
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

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:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44473

The programmers discuss this problem in details. Would you please read the
discussions? I believe that clang++ shall fix the problem.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180618/3e7c3f26/attachment-0001.html>


More information about the llvm-bugs mailing list