Re: error: call of overloaded ‘to_chars(std::array<char, 10>::pointer, std::array<char, 10>::pointer, const int&, std::chars_format)’ is ambiguous

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 26 Jul 2024 at 15:43, Saifi Khan via Gcc-help
<gcc-help@xxxxxxxxxxx> wrote:
>
> Hi:
>
> Attempting to compile the function 'test()' as shown below gives the following compiler error
>
> error: call of overloaded ‘to_chars(std::array<char, 10>::pointer, std::array<char, 10>::pointer, const int&, std::chars_format)’ is ambiguous
>
> Environment
>
>  GNU/Linux 6.9.3-arch1-1
>  GNU glibc 2.39
>  g++ 15.0.0 20240726 (experimental) (GCC)
>
>
> Compiler invocation
>
>  g++ -std=c++23 -v -O0 -fmodules-ts -lstdc++exp num2str.cc
>
>
> Code
>
> auto test () -> void {
>
>       int const num {433};
>
>       std::array <char, 10> str {};
>
>       std::to_chars_result result {
>             std::to_chars (
>                   str.data ()
>                   , str.data () + str.size ()
>                   , num
>                   , std::chars_format::fixed
>                   )
>       };
>
> }
>
>
> Any pointers ?

Read the error message. It tells you why it's ambiguous, and you can
see why your call didn't work.

https://en.cppreference.com/w/cpp/utility/to_chars




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux