[Bug libstdc++/84690] std::is_invocable not working for ambiguous calls
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 5 12:02:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84690
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Vincent Reverdy from comment #0)
> The std::is_invocable type trait from the standard library fails to detect
> that the first call in the main function is ambiguous. The program returns
> 1, 1, 1 instead of 0, 1, 1. This seems to be related to
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84689 and to
Isn't it identical?
The variadic templates in this version seem irrelevant to the bug.
#include <iostream>
#include <type_traits>
// A base class
struct base {void operator()(int){};};
// Two derived classes inheriting from the same base classes
struct derived1: base {
using base::operator();
};
struct derived2: base {
using base::operator();
void operator()(char);
void operator()(float);
};
// A class inheriting from both derived1 and derived2
struct functor: derived1, derived2 {
using derived1::operator();
using derived2::operator();
};
// Main function
int main()
{
std::cout << std::is_invocable_v<functor, int> << "\n";
std::cout << std::is_invocable_v<functor, float> << "\n";
std::cout << std::is_invocable_v<functor, char> << "\n";
}
*** This bug has been marked as a duplicate of bug 84689 ***
More information about the Gcc-bugs
mailing list