[LLVMbugs] [Bug 16953] New: Support constexpr with builtins (Enhancement)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 21 01:20:52 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16953

            Bug ID: 16953
           Summary: Support constexpr with builtins (Enhancement)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: npl at chello.at
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Hi,

I have somme annoying issues with using builtins for generating compile-time
constants. It works beautiful with gcc but clang apparently doesnt have
"constexpr builtins". Most of them should easily be able to work at compile
time, amongst them: __builtin_ffs, __builtin_clz, __builtin_ctz,
__builtin_popcount, __builtin_bswap32, __builtin_bswap64

For testing, compile the following with -std=c++11:

inline constexpr int popCount(const unsigned long uVal)
{
    return __builtin_popcountll(uVal);
}

int main()
{
    return popCount(45);
]

-- 
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/20130821/c3a1618c/attachment.html>


More information about the llvm-bugs mailing list