This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67860] New: [concepts] bug with overloaded, refined function with explicit and variadic template arguments


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

            Bug ID: 67860
           Summary: [concepts] bug with overloaded, refined function with
                    explicit and variadic template arguments
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Gcc gives this error compiling the below code. But function v1 is more
specialized than v2 so there should be no ambiguity.

main.cpp: In function âint main()â:
main.cpp:27:18: error: call of overloaded âf(double, float)â is ambiguous
   f<10>(3.0, 2.0f);
                  ^
main.cpp:18:6: note: candidate: void f(const Xs& ...) [with int <anonymous> =
10; Xs = {double, float}]
 void f(const Xs&... xs) {
      ^
main.cpp:23:6: note: candidate: void f(const Xs& ...) [with int <anonymous> =
10; Xs = {double, float}]
 void f(const Xs&... xs) {


/////////////////////////////////////////////////////////////////////////
inline constexpr bool and_impl() { return true; }

template <class OperandFirst, class... OperandsRest>
constexpr bool and_impl(OperandFirst operand_first,
                        OperandsRest... operands_rest) {
  return operand_first && and_impl(operands_rest...);
}

template <class... Operands> constexpr bool and_(Operands... operands) {
  return and_impl(operands...);
}

template <class X> concept bool C() { return true; }

// v1
template<int, class... Xs>
  requires and_(C<Xs>()...)
void f(const Xs&... xs) {
}

// v2
template<int, class... Xs>
void f(const Xs&... xs) {
}

int main() {
  f<10>(3.0, 2.0f);
  return 0;
}
/////////////////////////////////////////////////////////////////////////

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]