Skip to content

Ambiguous deduction guides in C++23 mode #46

Open

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>;
      | ^~~~~~~~~~~~

Activity

  1. unterumarmung commented on Aug 16, 2024

    @unterumarmung
    Owner

    Oh I'm sorry for the long response. I've not seen the notification from GitHub.

    To be honest, I've never tested this library with newer compilers. I wrote it when C++20 wasn't very well supported and that's why there are some workarounds...

    I'm not sure when I'll be able to test the issue and come up with a solution, but if you have one, I'll be glad to review it and merge.

  2. unterumarmung commented on Aug 16, 2024

    @unterumarmung
    Owner

    // Early GCC versions that support cNTTP were not able to deduce size_t parameter

    I guess these lines should be rewritten to type aliases and the support for the old GCC versions to be dropped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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