[Bug c++/69364] New: [concepts] failure to properly order constraints when using fold expressions
ryan.burn at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jan 19 19:31:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69364
Bug ID: 69364
Summary: [concepts] failure to properly order constraints when
using fold expressions
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: ---
The below code produces an ambiguous overload error.
I'm not completely sure if the concept-lite standard dictates that it should
compile (see discussion:
http://stackoverflow.com/questions/34843745/how-are-fold-expressions-used-in-the-partial-ordering-of-constraints),
but it seems like it ought to work.
///////////////////////////////////////////////////////////////////////
#include <iostream>
#include <type_traits>
template <class T> concept bool A = std::is_move_constructible<T>::value;
template <class T> concept bool B = std::is_copy_constructible<T>::value;
template <class T> concept bool C = A<T> && B<T>;
template <class _a, class _b>
requires A<_a> && A<_b>
void f(_a a, _b b) {
std::cout << "a\n";
}
template <class _a, class _b>
requires C<_a> && C<_b>
void f(_a a, _b b) {
std::cout << "c\n";
}
template <class... _tx>
requires (A<_tx> && ...)
void g(_tx... tx) {
std::cout << "a\n";
}
template <class... _tx>
requires (C<_tx> && ...)
void g(_tx... tx) {
std::cout << "c\n";
}
int main() {
f(3, 7.0); // works with no fold expressions
g(3, 7.0); // ambiguous overload error
return 0;
}
///////////////////////////////////////////////////////////////////////
More information about the Gcc-bugs
mailing list