https://bugs.llvm.org/show_bug.cgi?id=50306
Bug ID: 50306
Summary: [concepts] abbreviated concept syntax triggers
ambiguous overload warning
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Consider the following code that uses the "overloaded" class template idiom to
provide visit-like functionality, where the overloads are done with concepts.
https://godbolt.org/z/nMfEMfr7r
```
template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
template <class> concept A = true;
template <class T> concept B = A<T> and true;
template <class T>
auto visit(T t, auto op)
{
return op(t);
}
template <int M = 0>
int bar(int i) {
return visit(i, overloaded {
[]<A a>(a&&) { return 0; },
[]<B b>(b&&) { return 1; }
});
}
int n = bar(0);
#ifdef AMBIGUOUS
template <int M = 0>
#endif
int foo(int i) {
return visit(i, overloaded {
[](A auto&&) { return 0; },
[](B auto&&) { return 1; }
});
}
int m = foo(0); // error: call to object of type 'overloaded<(lambda at
<source>:27:9), (lambda at <source>:28:9)>' is ambiguous
```
The `bar` function defines the overload lambdas using `<[concept] Foo>` syntax
and works fine, the `foo` version uses abbreviated `[concept] auto` syntax and
reports as ambiguous, but *ONLY* when `foo` is a function template.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs