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

            Bug ID: 97704
           Summary: [11 Regression][concepts] Not working with explicit
                    types in function signatures?
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de
  Target Milestone: ---

Hi gcc-team,

consider the following program:

```c++
struct non_exisiting {};

template <typename t>
auto hard_error(t in)
{
    static_assert(in, "Failure");
    return;
}

template <typename t>
    requires requires { hard_error(t{}); }
constexpr auto foo(t, non_exisiting);

template <typename t>
constexpr auto foo(t, bool) { return false; };

int main()
{
    foo(0, false);
};
```

This worked since at least g++-7 up until g++-10.2, works with clang (11 and
trunk), as well as msvc.

I would expect that `foo(t, non_exisiting)` will not be considered, because it
would not be meaningful in this case (`bool` is not of type `non_exisiting` and
there is no conversion sequence from `bool` to `non_exisiting`).

See https://godbolt.org/z/3W5eG8

I hope this is a bug and not intended behaviour, because I encountered this
problem by using a range adaptor from the stdlib inside a templated class which
all of a sudden found `operator|` (a hidden friend of that range adaptor) by
ADL even though that operator did not match signature-wise.

If this is intended behaviour, what in world is the type of the second
parameter of `foo(t, non_exisiting)`?

Thank you!
  • [Bug c++/97704] Ne... gcc-bugs at marehr dot dialup.fu-berlin.de via Gcc-bugs

Reply via email to