Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous deduction guides in C++23 mode #46

Open
jwt27 opened this issue Jun 26, 2024 · 2 comments
Open

Ambiguous deduction guides in C++23 mode #46

jwt27 opened this issue Jun 26, 2024 · 2 comments

Comments

@jwt27
Copy link

jwt27 commented Jun 26, 2024

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>;
      | ^~~~~~~~~~~~
@unterumarmung
Copy link
Owner

unterumarmung commented Aug 16, 2024

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.

@unterumarmung
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants