Skip to content

Conversation

@maskit
Copy link
Member

@maskit maskit commented Apr 6, 2023

IOBuffer.cc: In function ‘auto make_buffer_size_parser()’:
IOBuffer.cc:99:3: error: call of overloaded ‘Lexicon(<brace-enclosed initializer list>)’ is ambiguous
   99 |   }](swoc::TextView esize) -> std::optional<int> {
      |   ^
In file included from IOBuffer.cc:30:
/home/maskit/src/trafficserver/lib/swoc/include/swoc/Lexicon.h:576:1: note: candidate: ‘swoc::_1_4_6::Lexicon<E>::Lexicon(const std::initializer_list<std::tuple<E, std::basic_string_view<char, std::char_traits<char> > > >&, swoc::_1_4_6::Lexicon<E>::DefaultHandler, swoc::_1_4_6::Lexicon<E>::DefaultHandler) [with E = int; swoc::_1_4_6::Lexicon<E>::DefaultHandler = std::variant<std::monostate, int, std::basic_string_view<char, std::char_traits<char> >, std::function<int(std::basic_string_view<char, std::char_traits<char> >)>, std::function<std::basic_string_view<char, std::char_traits<char> >(int)> >]’
  576 | Lexicon<E>::Lexicon(const std::initializer_list<Pair> &items, DefaultHandler handler_1, DefaultHandler handler_2) {
      | ^~~~~~~~~~
/home/maskit/src/trafficserver/lib/swoc/include/swoc/Lexicon.h:565:1: note: candidate: ‘swoc::_1_4_6::Lexicon<E>::Lexicon(const std::initializer_list<swoc::_1_4_6::Lexicon<E>::Definition>&, swoc::_1_4_6::Lexicon<E>::DefaultHandler, swoc::_1_4_6::Lexicon<E>::DefaultHandler) [with E = int; swoc::_1_4_6::Lexicon<E>::DefaultHandler = std::variant<std::monostate, int, std::basic_string_view<char, std::char_traits<char> >, std::function<int(std::basic_string_view<char, std::char_traits<char> >)>, std::function<std::basic_string_view<char, std::char_traits<char> >(int)> >]’
  565 | Lexicon<E>::Lexicon(const std::initializer_list<Definition> &items, DefaultHandler handler_1, DefaultHandler handler_2) {
      | ^~~~~~~~~~

@maskit maskit added the Build work related to build configuration or environment label Apr 6, 2023
@maskit maskit added this to the 10.0.0 milestone Apr 6, 2023
@maskit maskit requested a review from SolidWallOfCode April 6, 2023 06:32
@maskit maskit self-assigned this Apr 6, 2023
@maskit
Copy link
Member Author

maskit commented Apr 6, 2023

Works for C++20 but not C++17

@maskit maskit closed this Apr 6, 2023
@maskit maskit removed this from the 10.0.0 milestone Apr 6, 2023
@maskit maskit reopened this Apr 6, 2023
{
return [l = swoc::Lexicon<int>{
{{0, {"128"}},
{swoc::Lexicon<int>::Definition{0, {"128"}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be handled by swoc::Lexicon and not by us here. @SolidWallOfCode ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talk to @cmcfarlen - it's a bit of an odd use.

@SolidWallOfCode
Copy link
Member

I've been investigating this and I think the problem is the string_view constructor that takes iterators, which is new in C++20. This makes something like { value, { "name1", "name2"}} convertible to Pair{value, string_view{"name1", "name2")} which wasn't previously the case. I am pondering a couple of different approaches.

@dragon512
Copy link
Contributor

dragon512 commented May 9, 2023

I think this is the wrong fix.

it should be

--- a/iocore/eventsystem/IOBuffer.cc
+++ b/iocore/eventsystem/IOBuffer.cc
@@ -79,7 +79,7 @@ init_buffer_allocators(int iobuffer_advice)
 auto
 make_buffer_size_parser()
 {
-  return [l = swoc::Lexicon<int>{
+  return [l = swoc::Lexicon<int>{swoc::Lexicon<int>::with_multi
             {{0, {"128"}},
              {1, {"256"}},
              {2, {"512"}},

This should solve the issues with compiling with G++ 8.3 and above

@maskit
Copy link
Member Author

maskit commented May 11, 2023

#9700 will resolve the issue.

@maskit maskit closed this May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build work related to build configuration or environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants