Skip to content

Compile bug: Canot convert from char8_t to char* in llama-chat.cpp #12740

Closed
@WilliamTambellini

Description

@WilliamTambellini

Git commit

c262bed

Operating systems

Windows

GGML backends

CPU

Problem description & steps to reproduce

  • build with msvc22 and std cpp < 202000L
  • see compilation failure:
llama-chat.cpp: 
error C2664: 'bool llm_chat_detect_template::<lambda_1>::operator ()(const char *) const': 
cannot convert argument 1 from 'const char8_t [9]' to 'const char *'

because of this line

#define LU8(x) u8##x

First Bad Commit

No response

Compile command

cl.exe llama-chat.cpp /std-c++17 ...

Relevant log output

llama-chat.cpp(150): 
error C2664: 'bool llm_chat_detect_template::<lambda_1>::operator ()(const char *) const': 
cannot convert argument 1 from 'const char8_t [9]' to 'const char *'

Possible solution

#define LU8(x) reinterpret_cast<const char*>(u8##x)

seems to please the compiler

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions