https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85069

            Bug ID: 85069
           Summary: std::invoke_result returns a wrong type
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: akrzemi1 at gmail dot com
  Target Milestone: ---

`std::invoke_result` returns a wrong type. Consider the following source file:

```
#include <type_traits>

// log_type displays the type of T in compiler error 
template <typename T> void log_type() = delete;

struct F
{
  int operator()() { return 9; }
};

int main()
{
  log_type<std::invoke_result_t<F()>>();
}
```

I do not expect it to compile, but when generating error message it displays
the "return type" from the type trait. I expect the type of
`std::invoke_result_t<F()>` to be `int`, but instead, the compiler reports that
it is `F`. I do not get this problem when I use the deprecated trait
`std::result_of` instead.

Reply via email to