Skip to content

Ambiguous deduction guides in C++23 mode #46

Open
@jwt27

Description

@jwt27

Just trying this with gcc 14, any use of the fixed_string "alias" type fails to compile with -std=c++23:

#include <fixed_string.hpp>

template<fixstr::fixed_string>
struct stringy_type { };

using foo = stringy_type<"hello">;
$ g++-14 -I include -std=c++23 -c test.cpp
test.cpp:6:33: error: class template argument deduction failed:
    6 | using foo = stringy_type<"hello">;
      |                                 ^
test.cpp:6:33: error: call of overloaded ‘fixed_string(const char [6])’ is ambiguous
In file included from test.cpp:1:
include/fixed_string.hpp:518:1: note: candidate: ‘fixstr::basic_fixed_string(const char (&)[N])-> fixed_string<(N - 1)> [with long unsigned int N = 6]’
  518 | basic_fixed_string(const TChar (&)[N]) -> basic_fixed_string<TChar, N - 1>;
      | ^~~~~~~~~~~~~~~~~~
include/fixed_string.hpp:529:1: note: candidate: ‘fixstr::fixed_string(const char (&)[N])-> fixed_string<(N - 1)> [with long unsigned int N = 6]’
  529 | fixed_string(const char (&)[N]) -> fixed_string<N - 1>;
      | ^~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions