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

            Bug ID: 44684
           Summary: __builtin calls that would have produced integer
                    constants expressions on their own do not produce
                    integer constant when the builtin call is composed
                    across a _Generic selection
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

These all fail on clang while succeeding on gcc:

_Static_assert(_Generic(1u,unsigned:__builtin_clz)(1u),""); //✗
_Static_assert(_Generic(1u,unsigned:__builtin_popcount)(1u),""); //✗
_Static_assert(_Generic(1u,unsigned:__builtin_ctz)(2u),""); //✗

(Both gcc and clang successfully compile:

_Static_assert(__builtin_clz(1u),""); //✓
_Static_assert(__builtin_popcount(1u),""); //✓
_Static_assert(__builtin_ctz(2u),""); //✓
)

https://gcc.godbolt.org/z/_CpbSL

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to