Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[May be a BUG] clang++ 14.0.0: "undefined reference error" for an inline consteval function. #54578

Closed
Labels
c++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party
@yaoxinliu

Description

@yaoxinliu
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp