https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115000

            Bug ID: 115000
           Summary: Confusing 'cannot convert to 'int' in initialization'
                    error message
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

Consider the following:

#include <ranges>

struct S {
  S() = default;
  S(S&&) = default;
};

S s;
std::ranges::single_view<S> r{s};

https://godbolt.org/z/65nvdaTfP

GCC reports constraints not satisfied which is correct, however, there is more:

<source>:9:31: error: cannot convert 'S' to 'int' in initialization
    9 | std::ranges::single_view<S> r{s};
      |                               ^
      |                               |
      |                               S

This is confusing since there is nothing to do with 'int'.

Reply via email to