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

            Bug ID: 90287
           Summary: [concepts] bogus error on overload failure inside
                    requires-expression
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redbeard0531 at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/30Cf6s

#include <string>

template <typename T, typename U>
constexpr inline bool isAddable = requires(const T& lhs, const U& rhs) {
     lhs + rhs;
};

auto x = isAddable<int, std::string>;

<source>: In instantiation of 'constexpr const bool isAddable<int,
std::__cxx11::basic_string<char> >':
<source>:13:10:   required from here
<source>:10:10: error: no match for 'operator+' (operand types are 'const int'
and 'const std::__cxx11::basic_string<char>')
   10 |      lhs + rhs ;
      |      ~~~~^~~~~

[snip rest of wall-o-errors]

If I make isAddable a concept, it correctly evaluates to false, but I would
expect requires-expressions to also work when assigned to a constexpr bool.

Reply via email to