lh123 added a comment. > what do you think about unwrapping decltype only when it's a return value > (optional: of a function whose leading return type is auto) to narrowly catch > this idiom?
I think it's worth fixing in the declarations too. int &bar(int a, int b); template <typename Func, typename... Args> auto call(Func &&func, Args &&... args) -> decltype(func(std::forward<Args>(args)...)); template <typename T> void useRes(T &&t); void foo() { // Under c++11 we don't have decltype(auto), using auto here will lose // reference. decltype(call(bar, 5, 6)) res = call(bar, 5, 6); if (res) { // long code to process res useRes(res); // User wants to know the type of res here. } else { // long code to process res useRes(res); } } Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D72498/new/ https://reviews.llvm.org/D72498 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits