[LLVMbugs] [Bug 23462] New: std::linear_congruential_engine dies when type is uint8_t

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 8 16:22:58 PDT 2015


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

            Bug ID: 23462
           Summary: std::linear_congruential_engine dies when type is
                    uint8_t
           Product: libc++
           Version: 3.6
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: oneill+llvmbugs at cs.hmc.edu
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 14305
  --> https://llvm.org/bugs/attachment.cgi?id=14305&action=edit
Code that shows the bug

If you try to create an 8-bit LCG, the code fails to compile (instantiation of
the function-call operator fails).

Compile the attached code with

    clang++ -std=c++11 -o uint8_lcg uint8_lcg.cpp 

Observe the following errors.

In file included from uint8_lcg.cpp:1:
/some/where/llvm.236909/bin/../include/c++/v1/random:1888:49: error: 
      implicit instantiation of undefined template 'std::__1::__lce_ta<141, 1,
      0, 255, false>'
        {return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, ...
                                                ^
uint8_lcg.cpp:9:7: note: in instantiation of member function
      'std::__1::linear_congruential_engine<unsigned char, '\x8D', '\x01',
      '\x00'>::operator()' requested here
   gen();
      ^
/some/where/llvm.236909/bin/../include/c++/v1/random:1672:8: note: template
      is declared here
struct __lce_ta;
       ^
/some/where/llvm.236909/bin/../include/c++/v1/random:1888:77: error: 
      incomplete definition of type 'std::__1::__lce_ta<141, 1, 0, 255, false>'
  ...__x_ = static_cast<result_type>(__lce_ta<__a, __c, __m,
_Mp>::next(__x_));}
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
2 errors generated.


The standard doesn't restrict the integer type that may be used, so this is an
erroneous error.  Present in trunk and 3.6.  GCC 5.1 and earlier (libstdc++)
compile the code correctly.

-- 
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/20150508/e45fe5e9/attachment.html>


More information about the llvm-bugs mailing list