llvm generates IR with syntax error for C++20 bit_cast


I just hit a issue with syntax error in IR generated by LLVM involving std::bit_cast. The following is a repro (https://godbolt.org/z/xTzx3r):

#include <bits/stdc++.h>
static LiteralType f() noexcept {
static_assert(sizeof(LiteralType) == 1);
constexpr LiteralType v = __builtin_bit_cast(LiteralType, static_cast<uint8_t>(0));
return v;
auto g = f;

The generated IR for ‘g’ is:

define internal zeroext i1 @_ZL1fIbET_v() #3 !dbg !1631 {
call void @llvm.dbg.value(metadata i8 0, metadata !1633, metadata !DIExpression()), !dbg !1637
ret i8 0, !dbg !1638

which contains a syntax error of mismatching return value, and fails when passed to llc:

llvm-as t.ll
llvm-as: t.ll:17:7: error: value doesn’t match function result type ‘i1’
ret i8 0, !dbg !1639

The problem goes away if I remove the ‘constexpr’ assignment statement, and return directly.

Is this a bug with LLVM?