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: unassignedclangb...@nondot.org
          Reporter: psko...@gmail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

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
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to