This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67860] New: [concepts] bug with overloaded, refined function with explicit and variadic template arguments
- From: "ryan.burn at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Oct 2015 04:46:33 +0000
- Subject: [Bug c++/67860] New: [concepts] bug with overloaded, refined function with explicit and variadic template arguments
- Auto-submitted: auto-generated
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;
}
/////////////////////////////////////////////////////////////////////////