Consider the snippet below:
#include<tuple>
double refd = 5.0;
int refi = 1;
decltype(auto) foo(){return std::tuple<double&,int&>{refd,refi};}
auto&[d,i] = foo(); //msvc:pass, gcc:fail, clang:fail
Available on compiler explorer
In the case of gcc/clang, the error is:
error: cannot bind non-const lvalue reference of type
'std::tuple<double&,int&>&'
to an rvalue of type'std::tuple<double&, int&>'
However, MSVC does not complain and compiles just fine.
Which one is correct ?