http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56319
Bug #: 56319 Summary: call to implicitly-deleted copy constructor accepted Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: wlodzimierz.lip...@gmail.com Hi, GCC compiles following code. Copying of tuple of rvalues returned by: std::forward_as_tuple, should not be allowed because it is ill formed. (clang++ properly detects the problem and report an error.) /*----------------------------------------------------------------------------*/ template <unsigned int ...> struct TupleIndices {}; template< unsigned int I, typename IndexTuple, typename... Types> struct MakeTupleIndices_; template< unsigned int I, unsigned int... Indices, typename T, typename... Types> struct MakeTupleIndices_<I, TupleIndices<Indices...>, T, Types...> { typedef typename MakeTupleIndices_<I + 1, TupleIndices<Indices..., I>, Types...>::type type; }; template< unsigned int I, unsigned int... Indices> struct MakeTupleIndices_<I, TupleIndices<Indices...> > { typedef TupleIndices<Indices...> type; }; template<typename... Types> struct MakeTupleIndices : public MakeTupleIndices_<0, TupleIndices<>, Types...> {}; /*----------------------------------------------------------------------------*/ void bar(int) { } template <typename... Args, unsigned int... ArgsIndices> void fooImpl(std::tuple<Args...> args, TupleIndices<ArgsIndices...>) { bar(std::forward<Args>(std::get<ArgsIndices>(args))...); } template <typename... Args> void foo(std::tuple<Args...> args) { fooImpl(args, typename MakeTupleIndices<Args...>::type()); } /*----------------------------------------------------------------------------*/ enum { id = 1 }; int main() { foo(std::forward_as_tuple(id)); return 0; } /*----------------------------------------------------------------------------*/ Wlodzimierz.