A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/llvm/llvm-project/issues/54578 below:

[May be a BUG] clang++ 14.0.0: "undefined reference error" for an inline consteval function. · Issue #54578 · llvm/llvm-project · GitHub

inline consteval unsigned char operator""_UC(const unsigned long long n)
{
    return static_cast<unsigned char>(n);
}

inline consteval char f1(auto const octet)
{
    return char(octet >> 4_UC);
}

inline constexpr char f2(auto const octet)
{
    return char(octet >> 4_UC);
}

int main()
{
    auto c1 = f1('A'); // ok
    auto c2 = f2('A'); // error

    return c1 + c2;
}

Compiled with: clang++-14 -std=c++20 -stdlib=libc++, and the error message is:

undefined reference to `operator"" _UC(unsigned long long)'

See online demo: https://godbolt.org/z/WarbWYcfP

StackOverflow question link: https://stackoverflow.com/questions/71634835/why-does-consteval-not-behave-as-expected


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4