https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81933
Bug ID: 81933 Summary: [7 Regression] Invalid "constexpr call flows off the end of the function" error Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ldionne.2 at gmail dot com Target Milestone: --- The following code does not compile with GCC 7, std=c++14: ---------------------------------------------------------------------------- #include <tuple> struct any_udt { }; template <typename ...Tuples> constexpr auto flatten(Tuples ...tuples) { auto all = std::make_tuple(tuples...); auto flat = std::make_tuple( std::get<0>(std::get<1>(all)), std::get<0>(std::get<2>(all)) ); return flat; } constexpr auto fail = ::flatten(std::make_tuple(), std::make_tuple(any_udt{}), std::make_tuple(any_udt{})); int main() { } ---------------------------------------------------------------------------- It triggers the following error: foo.cpp:17:59: in constexpr expansion of 'flatten(Tuples ...) [with Tuples = {std::tuple<>, std::tuple<any_udt>, std::tuple<any_udt>}] (std::make_tuple(_Elements&& ...) [with _Elements = {any_udt}](), std::make_tuple(_Elements&& ...) [with _Elements = {any_udt}]())' foo.cpp:17:59: error: constexpr call flows off the end of the function std::make_tuple(any_udt{})); ^ Note that the code compiles just fine with GCC 6 and all Clang versions I've tried, so this looks like a 7 regression. Working example (GCC 6.3.0, -std=c++14): https://wandbox.org/permlink/5AjQ50OSxNjJPP8r Working example (GCC 6.3.0, -std=c++1z): https://wandbox.org/permlink/dKegxu0QeVXtzObB Failing example (GCC 7.2.0, -std=c++14): https://wandbox.org/permlink/hfbI0Ndg5UyCIF9W Working example (GCC 7.2.0, -std=c++1z): https://wandbox.org/permlink/Hz1gm6EipU5Ej5jy Failing example (GCC 8.0.0, -std=c++14): https://wandbox.org/permlink/jSHOPt8zXosccp8a Working example (GCC 8.0.0, -std=c++1z): https://wandbox.org/permlink/Nj7tNIYWu8Ueury7