https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81589
Bug ID: 81589 Summary: Possible False-Positive with decltype Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hunter at openrobotics dot org Target Milestone: --- I can confirm that this effects GCC-8.0 svn as well (have not tested with GCC-6). There's a header file which compiles just fine with GCC-5.4.0 (and GCC-4.9.4), but fails to compile with GCC-7.1.1 and GCC-8.0. Please note that I'm only reporting this because of the inconsistency. error: decltype cannot resolve address of overloaded function The problematic line is reported as this one: using arguments = typename tuple_tail< typename function_traits<decltype< & FuncitionT::operator())>::arguments>::type; In this context: #include <functional> #include <memory> #include <tuple> namespace rclcpp { namespace runction_traits { template<typename T> struct tuple_tail; template<typename Head, typename ... Tail> struct tuple_tail<std::tuple<Head, Tail ...>> { using type = std::tuple<Tail ...>; }; // std::function template<typename FunctionT> struct function_traits { using arguments = typename tuple_tail< typename function_traits<decltype( & FunctionT::operator())>::arguments>::type; static constexpr std::size_t arity = std::tuple_size<arguments>::value; template<std::size_t N> using argument_type = typename std::tuple_element<N, arguments>::type; using return_type = typename function_traits<decltype( & FunctionT::operator())>::return_type; }; /* other structs follow */ } } I'll attach the precompiler output from my computer with GCC 8 on it. I'll also note that our library, rclcpp, does compile with GCC 8, but, when we try to compile our tests or use the library elsewhere, the compiler throws errors. I'm super hesitant in reporting this, but I just can't see anything wrong in the code, and the inconsistency is certainly an issue. It should error in GCC 5.4 if it's "bad" code (also note that the code is being compiled with the same standard, C++-14).