PR c++/71117 - core 2189 and generic lambda
* call.c (add_template_conv_candidate): Disable if there are viable candidates. From-SVN: r238394
This commit is contained in:
parent
2a54351ba7
commit
4d031550cc
|
@ -1,5 +1,10 @@
|
|||
2016-07-15 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/71117
|
||||
Core 2189
|
||||
* call.c (add_template_conv_candidate): Disable if there are
|
||||
viable candidates.
|
||||
|
||||
PR c++/71511
|
||||
* typeck2.c (cxx_incomplete_type_diagnostic): Handle DECLTYPE_TYPE.
|
||||
|
||||
|
|
|
@ -3204,6 +3204,12 @@ add_template_conv_candidate (struct z_candidate **candidates, tree tmpl,
|
|||
tree return_type, tree access_path,
|
||||
tree conversion_path, tsubst_flags_t complain)
|
||||
{
|
||||
/* Making this work broke PR 71117, so until the committee resolves core
|
||||
issue 2189, let's disable this candidate if there are any viable call
|
||||
operators. */
|
||||
if (any_strictly_viable (*candidates))
|
||||
return NULL;
|
||||
|
||||
return
|
||||
add_template_candidate_real (candidates, tmpl, NULL_TREE, NULL_TREE,
|
||||
NULL_TREE, arglist, return_type, access_path,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Test for Core 2189.
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
// PR c++/71117
|
||||
// { dg-do compile { target c++14 } }
|
||||
|
||||
template <class T> T&& declval() noexcept;
|
||||
template <class, class>
|
||||
constexpr bool is_same = false;
|
||||
template <class T>
|
||||
constexpr bool is_same<T, T> = true;
|
||||
|
||||
template <class F>
|
||||
struct indirected : F {
|
||||
indirected(F f) : F(f) {}
|
||||
template <class I>
|
||||
auto operator()(I i) -> decltype(declval<F&>()(*i)) {
|
||||
return static_cast<F&>(*this)(*i);
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
auto f = [](auto rng) {
|
||||
static_assert(is_same<decltype(rng), int>, "");
|
||||
return 42;
|
||||
};
|
||||
indirected<decltype(f)> i(f);
|
||||
static_assert(is_same<decltype(i(declval<int*>())), int>, "");
|
||||
}
|
Loading…
Reference in New Issue